Skip to content

fix: guarantee panel version badge always renders - #4

Open
ShiyunXu wants to merge 6 commits into
iPmartNetwork:masterfrom
ShiyunXu:version-display-fix
Open

fix: guarantee panel version badge always renders#4
ShiyunXu wants to merge 6 commits into
iPmartNetwork:masterfrom
ShiyunXu:version-display-fix

Conversation

@ShiyunXu

Copy link
Copy Markdown

Ensures the panel version always displays in the sidebar, header and dashboard overview:

  • hooks.ts: export PANEL_VERSION (Vite-injected build version) and use it as initialData so useVersion().data is a string from first render
  • Overview.tsx / AppHeader.tsx: fall back to PANEL_VERSION like AppSidebar does
  • cmd/panel/main.go + web/package.json: sync fallback version to 1.3.2

Copilot AI and others added 6 commits August 25, 2026 07:02
…ANGELOG)

VERSION and CHANGELOG.md already record 1.4.1 as released, but several
hardcoded fallback version strings were still stuck at 1.4.0, so the
dashboard (via GET /api/version, whose response comes from
cmd/panel/main.go's package-level 'version' var) reported the previous
release unless the binary happened to be built with
-ldflags "-X main.version=..." overriding it (confirmed no build script
in this repo passes that flag, so the stale default was actually served).

- cmd/panel/main.go: version fallback 1.4.0 -> 1.4.1
- web/package.json + package-lock.json (root package only): 1.4.0 -> 1.4.1
- mkdocs.yml site_description: v1.4.0 -> v1.4.1
- docs/landing (Navbar, Footer, i18n translations en/ar/tr): v1.4.0 -> v1.4.1

Verified: go build ./... succeeds, npx tsc --noEmit clean, vite build
bundle contains "1.4.1" and no remaining "1.4.0", vitest passes (one
pre-existing unrelated failure in modal-bugcondition.test.ts reproduces
identically on master before this change).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
/api/version returned the hardcoded main.go default (1.4.0) while VERSION
was already 1.4.1. The UI prefers the API value over the __PANEL_VERSION__
build-time fallback, so the stale backend value won. Bump main.go and
package.json to 1.4.1 to match the VERSION file.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Overview (dashboard heading) and AppHeader read useVersion().data with no
fallback, so the version disappeared whenever GET /api/version errored or
was still loading (e.g. an admin/reseller lacking system:read gets 403).
Fall back to the build-time __PANEL_VERSION__ constant, matching AppSidebar,
so the installed panel version always renders.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The 1fcef72 fallback (?? __PANEL_VERSION__) only helps while the query
is pending or errored, but a 401 from /api/version also clears the auth
token and retries could leave data undefined in edge states. Passing the
build-time version as initialData makes useVersion().data a string from
the very first render — it flows through select() (unlike
placeholderData) and is upgraded to the live backend version when the
fetch succeeds. retry: false avoids hammering the endpoint on failure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ew/AppHeader

- hooks.ts now exports PANEL_VERSION (the Vite-injected build version)
  and uses it for initialData, keeping one source of truth.
- Overview.tsx and AppHeader.tsx mirror the AppSidebar pattern:
  useVersion().data ?? PANEL_VERSION, so the version badge can never
  render empty even if the query data is somehow undefined.

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