fix: stop the API key field showing a secret it has discarded - #126
Merged
Conversation
The wizard renders SecureKeyField with a constant value="", so the effect that syncs the draft depends on a prop that never changes. Switching Provider calls clearApiKey(), which empties the ref and flips hasApiKey to false -- but the input kept displaying what the user had typed for the previous Provider. The field showed a key that was no longer going to be saved, and the Continue button was disabled with nothing on screen explaining why. resetKey drives the clear instead. It skips its own first run, or the Provider editor -- which mounts this with the saved key already in value -- would discard it. Revealed state resets too, so the next Provider's field does not open unmasked. continueSetup returned early on providerHasKey before reading the ref, so a key typed in this session was dropped with no save call and no message while the page advanced as though it had worked. It now checks both. Refs #119 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #119. The issue described two paths where a typed key is dropped; the first turned out to be worse than reported.
The field displayed a key it had already thrown away
ProviderKeyPagerendersSecureKeyFieldwith a hardcodedvalue=""(:140), and the effect that syncs the draft depends on that prop — which never changes. SochangeProvider→clearApiKey()emptiedkeyRefand flippedhasApiKeyto false, but the input went on displaying what the user typed for the previous Provider.I verified this with a throwaway probe rather than trusting the read: after a re-render with
value="", the input still heldsk-typed.The user-visible state is worse than "the key is silently discarded" (what #119 says). The field shows a plausible-looking key,
canContinueis false becausehasApiKeywas cleared, and the Continue button is disabled with nothing on screen explaining why. The screen contradicts itself.resetKeydrives the clear instead. It skips its own first run — the Provider editor mounts this component with a saved key already invalue, and clearing there would discard it. Revealed state resets too, so the next Provider's field does not open unmasked.The second path
continueSetupreturned early onproviderHasKeyalone, before reading the ref, so a key typed in this session was dropped with no save call and no message while the page advanced as though it had worked. Now it checks both.Verification
pnpm run build,pnpm run test:e2e(6 passed)The
SaveKeyno-op noted in #119 is left alone —Store.SaveKeyreturning nil for an empty key is correct for its callers; the issue there was only that this page could reach it with nothing to save, which is now fixed upstream of it.🤖 Generated with Claude Code