Repository navigation
fix: show the chosen row in a settings dropdown, not its stored value - #140
Merged
Merged
Conversation
A closed Select renders the raw value unless the Root is handed the value-to-label map: its items only register themselves once the popup has been opened, so a trigger the user never opened stringifies whatever is stored. Three rows read wrong because of it. The default provider showed claude rather than Claude Code. The GitHub account showed __active__ — the placeholder that stands in for "no override", which a Select item cannot carry as the empty string — and showed github.com/you where the row it came from read you. The account map is built by accountSelectItems, beside accountLabel, so the two forms of a row cannot drift apart. The font picker is left alone: its value is the family name it displays, so it was already showing the right words.
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.
Summary
A closed
Selecttrigger showed the stored value instead of the row that was picked. Fixing the theme pickers in #131 turned up the same thing in two more places, and this closes them.base-ui resolves a trigger's label from the
itemsmap onSelect.Root. Without it,resolveSelectedLabelfalls through to stringifying the value — and since items only register themselves once the popup has been opened, a trigger the user never opened has nothing else to go on.Three rows read wrong:
claude__active__github.com/youyouThe
__active__one is the worst of the three: it is an internal placeholder standing in for "no override", because a Select item cannot carry the empty string that setting is actually stored as. On screen it reads like something broke.What changed
accountSelectItemsinlib/gh-account.ts, next toaccountLabel, builds the account picker's map so a row's two forms cannot drift apart. Covered by tests.idtonameis the whole mapping.ACTIVE_ACCOUNT_LABELis a constant now, so the row and the map cannot disagree about its wording.FontSettingis deliberately untouched: its value is the family name it displays, so it was already showing the right words.Not in this PR
There is no guard against the next
Selectshipping withoutitems. The obvious one — making the prop required incomponents/ui/select.tsx— would force a redundant identity map on every picker whose value already equals its label, andui/is shadcn-CLI territory, so a regenerate would drop the guard silently. The frontend gate is node-only, so no test can catch it either. Left as a known edge rather than papered over.Testing
gofmt -l .,go vet ./...,go test ./...(22 packages)cd frontend && ./node_modules/.bin/tsc --noEmitcd frontend && ./node_modules/.bin/vitest run— 621 passingcd frontend && ./node_modules/.bin/biome check src— 11 warnings, all pre-existing, none in these filescd frontend && ./node_modules/.bin/vite buildWorth a look in the running app rather than on the diff: open Settings › Providers and Settings › Version control without touching either dropdown, and read what the closed trigger says.