Fall back to build-time PANEL_VERSION in AppHeader and Overview - #3
Open
ShiyunXu wants to merge 1 commit into
Open
Fall back to build-time PANEL_VERSION in AppHeader and Overview#3ShiyunXu wants to merge 1 commit into
ShiyunXu wants to merge 1 commit into
Conversation
AppHeader.tsx and Overview.tsx both rendered the version badge only
when `useVersion().data` resolved (`{panelVersion && ...}`), with no
fallback. If GET /api/version fails for any reason (network error,
transient 401/403, request still in flight), `panelVersion` stays
undefined and the badge silently never renders.
AppSidebar.tsx already handles this correctly by falling back to the
Vite-injected `__PANEL_VERSION__` build-time constant:
const version = useVersion().data ?? PANEL_VERSION;
Applied the same fallback pattern to AppHeader.tsx and Overview.tsx so
the version is always shown immediately from the build-time constant
and seamlessly upgraded to the live API value once/if it resolves.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
AppHeader.tsxandOverview.tsxonly rendered the version badge whenuseVersion().dataresolved ({panelVersion && ...}), with no fallback. IfGET /api/versionfails for any reason (transient error, still loading, unexpected auth issue),panelVersionstaysundefinedand the badge never shows.AppSidebar.tsxalready handles this correctly:Applied the same fallback pattern to
AppHeader.tsxandOverview.tsxso the version always shows immediately from the build-time constant and upgrades to the live API value once it resolves.Verified with
tsc --noEmitandvite build.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com