fix(ui): resolve stale API version on first page load - #1493
Open
pratikshabelwate05 wants to merge 1 commit into
Open
fix(ui): resolve stale API version on first page load#1493pratikshabelwate05 wants to merge 1 commit into
pratikshabelwate05 wants to merge 1 commit into
Conversation
kowser-orkes
reviewed
Aug 6, 2026
Comment on lines
+26
to
+32
| // Fetch the server version reactively. useAPIReleaseVersion writes the | ||
| // result to localStorage on success, but reading localStorage once at | ||
| // module load time (the previous approach) captures a stale value on the | ||
| // first page load — the async fetch has not resolved yet, so the sidebar | ||
| // shows "latest" until a manual reload. Calling the hook here triggers a | ||
| // re-render when the version arrives, and we read the cached value from | ||
| // localStorage on every render so the sidebar updates immediately. |
Contributor
There was a problem hiding this comment.
Can we simplify the comment, or remove
Contributor
There was a problem hiding this comment.
Agreed with above.
Test and comment is over-kill.
PR should be One-line source code change here in BaseLayout.tsx please .
Contributor
|
Please clean-up PR description -- must be human written . Also, please include screenshot evidence of fix working on your local if at all possible |
BaseLayout read localStorage at module load time, before the async /version fetch resolved. On first load the value was null, so the sidebar showed "latest" until a manual reload. Use useAPIReleaseVersion instead so the component re-renders when the version arrives. Fixes conductor-oss#1489
pratikshabelwate05
force-pushed
the
fix/ui-version-stale-on-first-load
branch
from
August 6, 2026 21:06
7836fc3 to
5783389
Compare
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.
What's happening
On first load the sidebar footer shows
latest | latestinstead of the actual server version. After a manual reload it corrects itself.Why
BaseLayout.tsxwas readinglocalStorage.getItem("version")at module load time — before the async/versionfetch had a chance to resolve. On a fresh visitlocalStorageis empty, so the value wasnulland the sidebar fell back to"latest". The fetch wrote the real version tolocalStoragelater, but the module-level constant was never re-evaluated, so the UI stayed stale until you reloaded the page.Fix
Replace the module-level
localStorageread with a call touseAPIReleaseVersion()inside the component body. This hook was already being called inApp.tsxwith the same query key, so React Query deduplicates — no extra network request. The component now re-renders when the version arrives and the sidebar shows the correct value on first load.One line changed, no new dependencies, no backend changes.
Fixes #1489
Screenshots
Before (fresh page load, no reload):
After (fresh page load, no reload):
Both screenshots taken against a local dev server with a mock backend returning
3.32.0-rc.24from/api/version.localStoragewas cleared before each load to simulate a first-time visit.