fix: ProviderOnboarding: Maximum update depth loop on clean first-run profile#41
fix: ProviderOnboarding: Maximum update depth loop on clean first-run profile#41yhay81 wants to merge 3 commits into
Conversation
|
Thanks for the focused fix. I verified the new onboarding test locally: 2 tests passed, and moving fetchPresets out of render plus the StrictMode request guard correctly addresses the render/update loop from issue #40. One blocking concern: requestedPresetsRef.current is set to true before fetchPresets(). fetchPresets() catches request failures and only updates the store error, so after a transient preset API failure the component remains on the Loading spinner forever: it will not retry and ProviderOnboarding does not render the error. This can still make a clean first-run profile unrecoverable without restarting the app. Please add an error state with a retry path (or reset the request guard on failure) and a regression test covering reject-then-retry/success. The existing tests cover the successful response and already-loaded presets, but not this failure path. |
Fixes #40.
Summary
Root cause
fetchPresets()synchronously updates the provider store before awaiting the API. Calling it whileProviderOnboardingrendered caused the store update to re-render the component and call it again indefinitely.Validation
bun run --cwd desktop test --run src/components/onboarding/ProviderOnboarding.test.tsx— 2 tests passed under React StrictModedevbase: 740/758 passed; the same 18 pre-existing tests failed on both, with no PR-specific failuresbun run build— passedbun run build:sidecars— passed on Windows x64bun run tauri devwith isolatedCLAUDE_CONFIG_DIRand WebView2 data — advanced fromLoading...to the DreamField API Key form; noMaximum update depth exceededbun run lint— still fails on the unchangeddevbaseline; the TypeScript error set is identical and neither changed file appears in itFollow-up observation
The isolated profile correctly persisted
dreamcoder-locale=en, butProviderOnboardingstill renders hard-coded Chinese copy. That is separate from the render-loop fix and is intentionally not mixed into this single-purpose PR; it should be tracked as a follow-up.🤖 AI-authored PR, operated and verified by @yhay81.