Skip to content

Commit 5b04ba4

Browse files
committed
fix: address PR review feedback — storage fallback, pending request leak, snapshot refresh
- loadToken() now falls back to async storage when secure store unavailable - connect() rejects pending requests before closing socket (matches disconnect()) - requiresSnapshotRefresh returns false for thread.archived/unarchived
1 parent 3382b4f commit 5b04ba4

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

apps/mobile/src/lib/orchestration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ export function requiresSnapshotRefresh(event: OrchestrationEvent): boolean {
393393
case "project.deleted":
394394
case "thread.created":
395395
case "thread.deleted":
396+
case "thread.archived":
397+
case "thread.unarchived":
396398
case "thread.meta-updated":
397399
case "thread.runtime-mode-set":
398400
case "thread.interaction-mode-set":

apps/mobile/src/lib/remoteClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ export class RemoteClient {
214214
this.disposed = false;
215215
this.reconnectAttempt = 0;
216216
this.clearReconnectTimer();
217+
this.rejectPendingRequests(new Error("Reconnecting."));
217218
this.closeSocket();
218219
this.openWebSocket();
219220
}

apps/mobile/src/lib/storage.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,13 @@ async function loadToken(): Promise<string> {
9595

9696
const secureStore = await loadSecureStore();
9797
try {
98-
return secureStore ? ((await secureStore.getItemAsync(CONNECTION_TOKEN_KEY)) ?? "") : "";
98+
if (secureStore) {
99+
return (await secureStore.getItemAsync(CONNECTION_TOKEN_KEY)) ?? "";
100+
}
99101
} catch {
100-
return (await readStorageItem(CONNECTION_TOKEN_KEY)) ?? "";
102+
// fall through to async storage
101103
}
104+
return (await readStorageItem(CONNECTION_TOKEN_KEY)) ?? "";
102105
}
103106

104107
async function storeToken(token: string): Promise<void> {

0 commit comments

Comments
 (0)