Skip to content

Commit 84b0422

Browse files
joepioclaude
andcommitted
trim: drop unused waitForFirstDriveSync + supporting state
\`waitForFirstDriveSync\` had zero callers across the monorepo (lib, react, svelte, e2e, data-browser, sveltekit-site, integration tests). The supporting state (\`_firstDriveSyncPromise\`, \`_firstDriveSyncResolve\`) was also unused except by \`finishDriveSync\` resolving the latent promise. Also a latent flake risk: a caller awaiting this promise on a session that never completes a drive sync (sustained offline, or WS dying mid-handshake) would hang indefinitely — the disconnect path didn't reject. Better that the API not exist than ship that footgun. Removed: - \`waitForFirstDriveSync()\` public method - \`_firstDriveSyncPromise\` + \`_firstDriveSyncResolve\` private state - The \`finishDriveSync\` resolve hook (now just clears state) pnpm typecheck clean, pnpm test 37/37. Diff: −25 net. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0473802 commit 84b0422

1 file changed

Lines changed: 0 additions & 22 deletions

File tree

browser/lib/src/store.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,10 +1768,6 @@ export class Store {
17681768
this._driveSyncInProgress = false;
17691769
this._lastDriveSync = { drive, count, timestamp };
17701770
this.emitSyncStatus();
1771-
if (this._firstDriveSyncResolve) {
1772-
this._firstDriveSyncResolve();
1773-
this._firstDriveSyncResolve = undefined;
1774-
}
17751771
}
17761772

17771773
/** True once any drive sync has finished in this session. Used by
@@ -1782,24 +1778,6 @@ export class Store {
17821778
return this._lastDriveSync !== undefined;
17831779
}
17841780

1785-
/** Resolves once the WebSocket has run its first drive-sync handshake
1786-
* (`SYNC_DIFF` + `SYNC_PUSH` complete, `finishDriveSync` called). Used by
1787-
* collection fetches to defer the fallback `/query` GET until the local
1788-
* WASM DB has been populated by the sync — the index then satisfies the
1789-
* query locally and the server round-trip can be skipped entirely.
1790-
* Resolves immediately if a sync has already completed in this session. */
1791-
public waitForFirstDriveSync(): Promise<void> {
1792-
if (this._lastDriveSync) return Promise.resolve();
1793-
if (!this._firstDriveSyncPromise) {
1794-
this._firstDriveSyncPromise = new Promise<void>(resolve => {
1795-
this._firstDriveSyncResolve = resolve;
1796-
});
1797-
}
1798-
return this._firstDriveSyncPromise;
1799-
}
1800-
private _firstDriveSyncPromise: Promise<void> | undefined;
1801-
private _firstDriveSyncResolve: (() => void) | undefined;
1802-
18031781
public getSyncStatus(): StoreSyncStatus {
18041782
return {
18051783
serverConnected: this._serverConnected,

0 commit comments

Comments
 (0)