Skip to content

Commit 0922492

Browse files
committed
refactor(CollectorInvite): drop manual #accessInfo short-circuit, delegate to lib cache
pryv@3.1.0 introduces a per-Connection accessInfo cache with the same `forceRefresh` parameter the wrapper already exposed. The local short-circuit `if (!forceRefresh && this.#accessInfo) return this.#accessInfo` became redundant. Kept: - `#accessInfo` field as a sync-read mirror for the `patientUsername` getter - `forceRefresh` parameter passed through to the lib (Phase 2 test fix shows real callers need this after revoke/delete) - `invalid-access-token` → revokeInvite side effect Plan 58 Phase 4a. 488/488 tests pass.
1 parent e7cf0bf commit 0922492

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

ts/appTemplates/CollectorInvite.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,16 @@ export class CollectorInvite {
160160
/**
161161
* Check if connection is valid. (only if active)
162162
* If result is "forbidden" update and set as revoked
163-
* @returns accessInfo if valid.
163+
*
164+
* Caching is delegated to `pryv.Connection.accessInfo()` (per-Connection cache
165+
* introduced in pryv@3.1.0). Pass `forceRefresh=true` to bust the cache —
166+
* required after operations that invalidate the access (revoke, delete).
167+
*
168+
* The `#accessInfo` field mirrors the result for the sync `patientUsername` getter.
164169
*/
165170
async checkAndGetAccessInfo (forceRefresh: boolean = false): Promise<any> {
166-
if (!forceRefresh && this.#accessInfo) return this.#accessInfo;
167171
try {
168-
this.#accessInfo = await this.connection.accessInfo();
172+
this.#accessInfo = await this.connection.accessInfo(forceRefresh);
169173
return this.#accessInfo;
170174
} catch (e: any) {
171175
this.#accessInfo = null;

0 commit comments

Comments
 (0)