Repository navigation
feat(tabs): the address names the open tab, and same-page links keep it - #736
Merged
Merged
Conversation
On /observability, picking a time range jumped the reader from the tab they were on (Telemetry) back to the first tab: the range chips navigate to /observability?range=1h, and the Tabs widget read ?tab only on load and never wrote it, so nothing could carry it (Diego, 2026-11-15: tabs keep the address in step). - Tabs: choosing a tab replaces ?tab=<label> in the current history entry (history.replaceState with the current state, as pageFragment does): no new entry, no router navigation, no re-render. - navigation: `tab` is PAGE STATE, carried only on a navigation that stays on the same page (never to another page, whose tabs differ), and a target that names its own tab wins. - useWidgetQuery: buildExtrasParam leaves `tab` out, so every widget's key and snowplow L1 cell are the same whichever tab the address names. No schema or CRD change; no portal change needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N8HNbChC1PxtHfCivwZLyD
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.
The bug
Found on krateo-057 while checking portal 1.8.126, read-only. On /observability, while on the Telemetry tab, picking a time range (1h / 6h / 24h / 7d) lands you back on the first tab, Reconciliation.
/observability?range=1h&…without?tab.?tab=<label>once on load (defaultActiveKey) and never writes it. Clicking a tab doesn't change the address, so no link can carry the open tab.Diego's decision (2026-11-15): tabs keep the address in step.
The change
widgets/Tabs.onChangereplaces?tab=<label>in the current history entry (history.replaceState(window.history.state, …), the same waycontext/pageFragmentdoes). Back still leaves the page, a copied link reopens the tab, and nothing is written if the address already names it.utils/navigation.PAGE_STATE_PARAMS = ['tab']rides along incarryScopeParams(whichnavigateOrExternalapplies to every widget navigation) only when the target stays on the same page. It never goes to another page, whose tabs differ, and a target that names its owntabwins.?projectskeeps working exactly as before.hooks/useWidgetQuery.buildExtrasParamleavestabout of the extras.tabis page state, not a data input (no portal template reads it), so every widget's react-query key and snowplow L1 cell stay the same whichever tab the address names. Switching tabs refetches nothing, and neither does opening a deep link.Before this,
tab(when present on a deep link) went into every widget's key. Dropping it means those URLs map to the same cells as the plain page.Why not just add
?tabto the portal's range chips? Their routes are computed server-side when they load. Clicking a tab doesn't refetch them, so they'd carry a stale tab. Carrying page state at navigation time is the one place that always sees the open tab, and it needs no portal change.Evidence
navigation.test.ts./observability?range=1hfrom?tab=Telemetry→…&tab=Telemetry)./compositions?kind=Installer).tabwins.Tabs.deeplink.test.tsx. Clicking Telemetry callsreplaceStateonce with/observability?range=24h&tab=Telemetryand neverpushState. If the address already names the tab, nothing is written.tabPageState.extras.test.ts.tabis dropped and every other key keeps its order; the key is identical with or without?tab; a URL holding only?tabgives the empty envelope.vitestover navigation, Tabs, the new test and the existing extras tests (callerExtras,useWidgetQuery,widgetScope.extras,pageFragment): 7 files, 103 tests passed.npm run typecheckandeslinton the changed files: clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01N8HNbChC1PxtHfCivwZLyD