Repository navigation
fix(settings): keep opt-in-only experiment rows for the whole Settings visit - #49593
Conversation
…s visit The latch lived in the Experimental pane, which unmounts when the user leaves the section or types a search that hides it, so a switched-off row could vanish mid-visit. Settings now holds it for the visit and feeds both the pane and Settings search, which also lets the Option-click unlock reach search. Docs say the Agent Dashboard is no longer offered to new users.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ELI5
Follow-up to #49474. If you switch Agent Dashboard or Terminal attention off, its row now stays until you close Settings. Before, it could disappear mid-visit. The docs no longer tell new users to turn on a switch they can't see.
What Changed
Before:
After:
agents-sessions.mdxandsettings.mdxsay the Agent Dashboard is no longer offered to new users, and that its switch shows only if it is already on.Mechanism:
useStateinsideExperimentalPane.SettingsSectionreturnsnullwhen it isn't the active section, or when a search hides it, so the pane unmounted and the latch reset.useOptInOnlyExperimentRowsis called once inuseSettingsStoreModel, which lives exactly as long as the Settings page. It latches any row seen on during the visit, including settings that load late, and adds in the unlock.ExperimentalPane(new required prop) and touseSettingsNavigationMetadata(new optional third parameter), so the pane and Settings search always agree.Why
The row and its search hit should follow the Settings visit, not the Experimental section's mount. Holding the latch in the page model fixes the pane and search together, with no new stored data. Checked against how comparable products handle this.
Linked Issue
Follow-up to #49474.
Visual Proof
N/A. The two Experimental fixtures (
newUserHidesOptInOnlyExperiments,optedInKeepsOptInOnlyExperiments) render exactly as in #49474. What changed is how long a row stays during a Settings visit, which a still image can't show. The hook test below covers it.Testing
New
use-opt-in-only-experiment-rows.test.tsruns the real hook with no mocks. It covers two invariants:On main the hook does not exist, and the latch reset whenever the pane remounted.
Ran
pnpm lint(49 steps), the renderer (web) typecheck and the new test locally. All pass. The React Compiler compatibility ratchet also passes.Platform: macOS. The change is renderer-only and the same everywhere.
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None, because this only runs while Settings is open. It adds one
useStateand two boolean reads per Settings render. The returned object is memoized on two booleans, and the navigation memo still depends on primitives, so nothing recomputes unless one of those two settings or the unlock changes.Risk
Level: Low.
The worst case is a row staying visible slightly longer than before, until Settings closes. New users still see nothing unless a setting is on or they Option-click. A plain revert restores #49474's behaviour, and no stored data changes.
Review
Agent skill upstream boundary
Notes
No new strings.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)