feat: refresh long-lived tabs after a new build is deployed - #1040
Open
lucamzanon wants to merge 6 commits into
Open
lucamzanon wants to merge 6 commits into
lucamzanon wants to merge 6 commits into
Conversation
Bulwark talks to the mail server directly, so a tab can sit on the inbox for days without asking Next.js for a page and never notices a deploy. Every build now bakes a unique stamp; /api/system/build returns the server's. The client polls it every 5 minutes and on visibility/online changes: a hidden tab reloads silently, a visible one gets a banner with a reload button.
lucamzanon
force-pushed
the
feat/build-refresh
branch
from
September 18, 2026 16:58
207956d to
9a1ae49
Compare
Upstream replaced lucide-react with components/icons.
lucamzanon
force-pushed
the
feat/build-refresh
branch
from
September 30, 2026 16:58
9f71c58 to
d833fa7
Compare
Lite is a static bundle: there is no /api/system/build to ask and no server build to follow, and its verifier rejects a client chunk that names an undocumented server endpoint. The banner is not mounted under Lite, and the stamp lookup answers "unknown" there.
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.
Long-lived tabs never notice a deploy: Bulwark talks to the JMAP server directly, so a tab can sit on the inbox for days without ever asking Next.js for a page, and keeps running the JavaScript it loaded before the upgrade. Users then report "the new feature isn't there" until they happen to reload.
This adds a small self-refresh mechanism:
next.config.tsbakesNEXT_PUBLIC_BUILD_STAMP(short commit + build timestamp, unique even for rebuilds of the same commit) into both bundles.GET /api/system/buildreturns the stamp of the build serving the request (Cache-Control: no-store, no other information).components/build-refresh.tsx, mounted in the locale layout, compares the two every 5 minutes and whenever the tab becomes visible or comes back online (rate-limited to once a minute). On a mismatch a hidden tab reloads silently, so the user comes back to the current build; a visible tab keeps its state and shows a top banner with a reload button, and reloads by itself as soon as it goes to the background.build_refresh(title,reload) in all locales, English text where not translated.Tests:
components/__tests__/build-refresh.test.tsxcovers same build (silent), visible tab (banner, then reload once hidden), hidden-tab reload and re-check on visibility, and the no-stamp case.tscand translation tests pass.