Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (antigravity): sync the pickInitialModel ref in an effect, not during render

[._.]/ Adam Eivyda8abb919381
diff --git a/client/src/hooks/useProviderModels.js b/client/src/hooks/useProviderModels.js
index d75bda1c6e..36638b3c70 100644
--- a/client/src/hooks/useProviderModels.js
+++ b/client/src/hooks/useProviderModels.js
@@ -81,9 +81,11 @@ export default function useProviderModels({ filter, allowDefault = false, silent
// caller whose filter identity changes when a capability list resolves would
// otherwise re-run the whole `api.getProviders()` fetch for a change that
// needs no new data. The ref hands the async body the freshest picker without
- // pulling it into the dependency list.
+ // pulling it into the dependency list — synced in an effect (never mutated
+ // during render), which is soon enough: `load` only reads it after awaiting
+ // the fetch, and the initial value covers the mount.
const pickInitialModelRef = useRef(pickInitialModel);
- pickInitialModelRef.current = pickInitialModel;
+ useEffect(() => { pickInitialModelRef.current = pickInitialModel; }, [pickInitialModel]);
const load = useCallback(async () => {
setLoading(true);