Skip to content

feat(profile): URL-backed active tab (closes #1057)#1114

Open
jeromehardaway wants to merge 1 commit into
masterfrom
feat/profile-tab-url-state
Open

feat(profile): URL-backed active tab (closes #1057)#1114
jeromehardaway wants to merge 1 commit into
masterfrom
feat/profile-tab-url-state

Conversation

@jeromehardaway
Copy link
Copy Markdown
Contributor

Summary

  • Active profile tab was held in local React state, so refresh always sent the user back to "command-center" — even if they were viewing Arsenal, Settings, or Service Record. Tabs could not be deep-linked or shared either.
  • Derives `activeTab` from `router.query.tab` against `PROFILE_TABS`; falls back to default on missing/invalid values without crashing.
  • `onTabChange` uses `router.push` with `{ shallow: true, scroll: false }` so `getServerSideProps` does not re-run on tab clicks.
  • Default tab (`command-center`) is omitted from the query string to keep the canonical URL clean: `/profile/{id}` rather than `/profile/{id}?tab=command-center`.

Closes #1057.

Test plan

  • `npm test` — 380/380 pass
  • `npx biome check` on changed file — clean
  • Manual: click each tab, confirm URL updates and `getServerSideProps` does not refetch
  • Reload while on Settings, Arsenal, Training — tab is preserved
  • Deep link `/profile/{id}?tab=service-record` opens directly on that tab
  • `/profile/{id}?tab=garbage` falls back to Command Center, no crash
  • Back/forward navigation moves between tabs without full page reload

Closes #1057.

Profile tab state was in local React state, so refresh always sent
the user back to "command-center" — even if they were viewing
Arsenal or Service Record. Tabs also could not be deep-linked.

The active tab is now derived from router.query.tab and synced via
shallow routing on click. Invalid ?tab= values fall back to the
default without crashing. The default tab is stripped from the URL
to keep the canonical /profile/{id} clean.
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vets-who-code-app Error Error May 13, 2026 2:46am

Request Review

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.

Profile tab state should be URL-backed (refresh loses active tab)

1 participant