Skip to content

fix(ui): resolve stale API version on first page load - #1493

Open
pratikshabelwate05 wants to merge 1 commit into
conductor-oss:mainfrom
pratikshabelwate05:fix/ui-version-stale-on-first-load
Open

fix(ui): resolve stale API version on first page load#1493
pratikshabelwate05 wants to merge 1 commit into
conductor-oss:mainfrom
pratikshabelwate05:fix/ui-version-stale-on-first-load

Conversation

@pratikshabelwate05

@pratikshabelwate05 pratikshabelwate05 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What's happening

On first load the sidebar footer shows latest | latest instead of the actual server version. After a manual reload it corrects itself.

Why

BaseLayout.tsx was reading localStorage.getItem("version") at module load time — before the async /version fetch had a chance to resolve. On a fresh visit localStorage is empty, so the value was null and the sidebar fell back to "latest". The fetch wrote the real version to localStorage later, but the module-level constant was never re-evaluated, so the UI stayed stale until you reloaded the page.

Fix

Replace the module-level localStorage read with a call to useAPIReleaseVersion() inside the component body. This hook was already being called in App.tsx with 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):

Before fix

After (fresh page load, no reload):

After fix

Both screenshots taken against a local dev server with a mock backend returning 3.32.0-rc.24 from /api/version. localStorage was cleared before each load to simulate a first-time visit.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify the comment, or remove

@NicholasDCole NicholasDCole Aug 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with above.
Test and comment is over-kill.
PR should be One-line source code change here in BaseLayout.tsx please .

@NicholasDCole

Copy link
Copy Markdown
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
pratikshabelwate05 force-pushed the fix/ui-version-stale-on-first-load branch from 7836fc3 to 5783389 Compare August 6, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

on first load of the conductor UI, version shows latest| latest but on reload, it shows latest | <correct version>

3 participants