Repository navigation
fix(store): preserve concurrent local saves during polling and clear stale error on reconnect - #6338
Open
CrowAleksito wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Author
|
Rebased cleanly onto latest main (f4ab919) — ready for review. |
CrowAleksito
force-pushed
the
fix/polling-preserve-concurrent-saves-5619
branch
from
November 18, 2026 17:28
29008aa to
3c7a4cb
Compare
…stale error on reconnect
Author
|
Rebased cleanly onto latest |
CrowAleksito
force-pushed
the
fix/polling-preserve-concurrent-saves-5619
branch
from
November 20, 2026 18:18
3c7a4cb to
37a7b1c
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-opens #6137 (originally submitted Nov 7 2026-11-07T02:29:19Z and endorsed by #6157; auto-closed by stale bot while awaiting maintainer review, rebased cleanly onto latest main).
Summary
Fixes #5619
/claim #5619
Addresses tscircuit/tscircuit#5368
Problem
useRunFrameStore.startPolling(),stateis captured beforeawait getEvents(state.lastEventTime)andconst updates = new Map(state.fsMap)clones the stale file map before awaitinggetFileApi(event.file_path). WhenupsertFileor manual-edit saves finish while either request is in flight,set({ fsMap: updates })replacesfsMapwith the stale clone, losing newly added or updated local files.error, subsequent successful polls never reseterrorback tonull, leavingApiStatusIndicatorstuck showing"Dev server disconnected"aftertsci devrestarts.Solution
Map<FilePath, FileContent | null>, withnullmarkingFILE_DELETED) and merge them functionally againstcurrentState.fsMap(set((currentState) => ...)).get().lastManualEditsChangeSentAtat check time rather than from the pre-await snapshot.errortonullwhen a poll cycle completes without throwing (if (get().error !== null) set({ error: null })).Validation
tests/runframe-polling-concurrent-files.test.tscovering:upsertFileupdates and additions while/events/listis pending.upsertFileupdates and additions while/files/getis pending.errorstate tonullwhen a subsequent poll succeeds after a connection failure.bun test tests/runframe-polling-concurrent-files.test.ts(3/3 pass),bunx tsc --noEmit, andbiome format.