fix(settings): reset to General on bare /settings so browser Back can't strand a stale tab - #415
Merged
Conversation
…'t strand a stale tab (stenolabs#405) Follow-up to stenolabs#411: nav-rail clicks now push ?tab= entries onto the hash history, so browser Back can land on bare /settings - the route-sync effect previously ignored the absent param and left the old tab visible. Shares one tabFromRoute resolver between first-mount initialTab and the sync effect, and adds a T1 regression test.
Contributor
There was a problem hiding this comment.
No issues found across 2 files
You’re at about 92% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
21 tasks
Merged
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.
Follow-up to #411 (which closed #405): one edge of the tab/URL divergence is still reachable.
The leftover bug
#411 made the route the single source of truth - nav-rail clicks now navigate
/settings?tab=<id>and push entries onto the hash history. But the route->tab sync effect only reacts to a valid?tab=param and ignores a bare/settings. So:/settings, General visible).?tab=ai)./settings, but the AI tab stays visible. Tab and URL have diverged again, and a subsequentnavigate('/settings')from anywhere bails on the unchanged hash, so nothing ever corrects it.Fix
tabFromRouteresolver used by both the first-mountinitialTaband the route-reactive sync effect, so their semantics can't drift.?tab=the same way first mount does: reset to General.Test
New T1 regression in
settings-cmdk-search.t1.spec.ts: nav to AI via the rail, browser Back, assert the hash is exactly#/settingsand General is visible again. Verified the test fails on current main and passes with the fix.Verification
typecheck:rendererclean;lint:rendereridentical warning count to main (35/35, no new findings).settings-cmdk-searchT1 spec: 5/5 passing (including fix(settings): ⌘K search tab-state/URL divergence + index gaps (closes #405) #411's regression test).Summary by cubic
Fix Settings tab desync when going Back to bare
/settings. If?tab=is missing, the visible tab now resets to General so the tab and URL stay in sync after nav-rail clicks.tabFromRouteresolver used by both the initial tab and the route-sync effect to keep behavior aligned.?tab=as General, fixing the leftover edge case from Settings ⌘K search: tab state and URL diverge, then a search silently does nothing #405 after fix(settings): ⌘K search tab-state/URL divergence + index gaps (closes #405) #411.#/settings, and verifies General content is shown.Written for commit 1c30d62. Summary will update on new commits.