fix(settings): persist API key, provider, model, and integrations#1
Open
NewCoder3294 wants to merge 1 commit into
Open
fix(settings): persist API key, provider, model, and integrations#1NewCoder3294 wants to merge 1 commit into
NewCoder3294 wants to merge 1 commit into
Conversation
The settings page was a static mockup — every input was a presentational component with no state, no onChange, and no persistence. A user pasting their Anthropic key into API_KEY.SAV saw it sit in the field briefly and then vanish on reload. Adds a zustand store (web/src/lib/settings-store.ts) backed by the persist middleware, so the provider, API key, model, and integration fields cache to localStorage under "prometheus-settings-v1" and survive reloads, HMR, and browser restarts. The Go API still reads its own provider key from PROMETHEUS_ORCHESTRATOR_API_KEY at server boot — this store is the UI's working copy until a server-side settings endpoint exists. Nothing leaves the browser. The settings page is now controlled (provider buttons toggle the store, inputs are value/onChange-bound), guards against the SSR-vs-localStorage hydration mismatch, and adds a "Reset all" affordance for cache clearing. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
onChange, and no persistence. A user pasting an Anthropic key intoAPI_KEY.SAVsaw it sit in the field briefly and vanish on reload.web/src/lib/settings-store.tsthat cachesprovider,apiKey,model, and the three integration fields tolocalStorageunderprometheus-settings-v1.web/src/app/settings/page.tsxto be controlled (provider buttons toggle the store, inputs are value/onChange-bound), with a hydration guard so values don't flash empty after reload, plus a new "Reset all" affordance.Scope
PROMETHEUS_ORCHESTRATOR_API_KEYat server boot — this store is the UI's working copy until a server-side settings endpoint exists.web/package.json).useEffect-on-mount pattern; SSR renders empty inputs and localStorage rehydrates client-side.Test plan
cd web && npm install && npm run dev— settings page loads.🤖 Generated with Claude Code