Skip to content

Fall back to build-time PANEL_VERSION in AppHeader and Overview - #3

Open
ShiyunXu wants to merge 1 commit into
iPmartNetwork:masterfrom
ShiyunXu:fix/upstream-version-fallback-ui
Open

Fall back to build-time PANEL_VERSION in AppHeader and Overview#3
ShiyunXu wants to merge 1 commit into
iPmartNetwork:masterfrom
ShiyunXu:fix/upstream-version-fallback-ui

Conversation

@ShiyunXu

Copy link
Copy Markdown

AppHeader.tsx and Overview.tsx only rendered the version badge when useVersion().data resolved ({panelVersion && ...}), with no fallback. If GET /api/version fails for any reason (transient error, still loading, unexpected auth issue), panelVersion stays undefined and the badge never shows.

AppSidebar.tsx already handles this correctly:

const version = useVersion().data ?? PANEL_VERSION; // PANEL_VERSION = __PANEL_VERSION__ (Vite build-time define)

Applied the same fallback pattern to AppHeader.tsx and Overview.tsx so the version always shows immediately from the build-time constant and upgrades to the live API value once it resolves.

Verified with tsc --noEmit and vite build.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

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>
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.

2 participants