Repository navigation
Make open pages always take a newer frontend build - #610
Open
thiblahute wants to merge 1 commit into
Open
thiblahute wants to merge 1 commit into
thiblahute wants to merge 1 commit into
Conversation
An open page noticed each new build after an upgrade but never reloaded:
the reload waited while any editable field held text, and an empty chat
box counted, its CodeMirror placeholder ("Message claude...") being text
of the editor. Any page showing an agent chat, desktop or phone, stayed on
the build it was loaded with, for hours, and ran old code against the new
server.
A placeholder is no longer text, and only text the user typed in a field
that does not keep it holds the reload. The message boxes' drafts are
kept in the browser and come back after it, and attached images show as
[Image #N] again. The reload waits for sending and uploads and for a
pause in typing; an open dialog closes with it once the page has been
left alone two minutes or is hidden. A wait longer than 15 s, or one only
the user can end, shows a notice saying why, with a button to reload now.
The page also checks every five minutes.
The initial JS budget goes from 833 to 836 KiB and its gzip budget from
257 to 258 KiB for the notice and the reload logic.
This branch has not been 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.
Summary
Make an open page actually take a newer frontend build: an empty chat box no longer holds the reload back, drafts survive it, and a page that has to wait says why with a button to reload now. A follow-up to #533.
Why
Since #533 an open page notices a new build after an upgrade, but in practice it never reloaded: the reload waited while any editable field held text, and an empty chat box counted, its CodeMirror placeholder ("Message claude...") being text of the editor. Any page showing an agent chat, desktop or phone, stayed on the build it was loaded with for hours and ran old code against the new server.
What changed
web/src/frontendFreshness.ts:editableTextskips.cm-placeholder,aria-hiddenand non-editable parts).keydown,inputorpastein it) in a field that does not keep it holds the reload. Boxes markeddata-draft-savedand fields the page filled in itself never do.reloadHolddecides what holds the reload and until when: sending and uploads and a pause in typing (5 s) end by themselves; an open dialog closes with the reload once the page has been left alone 2 minutes or is hidden; unsaved typed text waits for the user.checkFrontendFreshness()lets code that fails against the server ask at once.frontendFreshnessState,subscribeFrontendFreshness,reloadForNewerBuild) for the notice.web/src/App.tsx: a "A new version of Roamgate is available" toast when the wait is longer than 15 s or only the user can end it, saying what it waits for, with "Reload now". Dismissed, it comes back after 10 minutes.web/src/terminalComposer.ts:terminalComposerDraftSaved(key);TerminalComposerandAgentHistoryComposermark themselvesdata-draft-savedwhen their draft is kept in the browser.web/src/composerAttachments.ts: attachments' paths and names are kept in the tab's session storage, so a reloaded draft shows its images as[Image #N]again (without thumbnails).scripts/check-web-assets.mjs: initial JS budget 833 to 836 KiB, gzip 257 to 258 KiB.FEATURES.md: the reload paragraph.Verification
bun test web/src/frontendFreshness.test.ts web/src/terminalComposer.persistence.test.ts web/src/composerAttachments.test.ts web/src/components/AgentHistoryComposer.test.tsx: 46 pass. New tests, which fail onmain:frontendFreshness.test.ts: "what holds a reload back, and until when", "an editor's placeholder is not text", "an empty chat box shown with its placeholder does not hold the reload", "a composer's draft is kept by the browser and does not hold the reload", "a page filled-in field does not hold the reload, a typed one does", "typing holds the reload until a pause", "an open dialog is closed by the reload once the page is left alone", "typed text never reloads by itself, but the notice's button does", "a short wait shows no notice, a long one does", "the page checks by itself now and then, and when something fails"terminalComposer.persistence.test.ts: "a pane's box says its draft outlives a reload once its scope is active"composerAttachments.test.ts: "a reload shows a draft's images as [Image #N] again, without thumbnails"bun run format:check,bun run lint(only the existingTerminalView.tsxwarning),bun run typecheck:bun,bun run build:web,bun run test:quickwith an isolatedHOME/TMPDIR.Compatibility
Frontend only. An open dialog (settings, a confirmation) is now closed by the reload once the page has been left alone two minutes; text typed into it still holds the reload until the user sends, clears or reloads. The existing tests for unsent text, an unfocused API key in a dialog, and pending uploads still pass.
Manual checks
[Image #1].