generated from cording12/next-fast-turbo
-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Description
Several useEffect hooks use whole objects (like searchSpace or preferences) as dependencies, but only access specific properties inside the effect body. This causes the effect to re-run whenever TanStack Query returns a new object reference, even if the relevant properties haven't changed.
Vercel React Best Practices Rule: rerender-dependencies (5.6)
Files to change
surfsense_web/components/settings/general-settings-manager.tsxsurfsense_web/components/settings/prompt-config-manager.tsxsurfsense_web/components/settings/llm-role-manager.tsx
What to do
In general-settings-manager.tsx (line 51):
The init effect uses searchSpace.name and searchSpace.description, but depends on [searchSpace]:
// Before
}, [searchSpace]);
// After
}, [searchSpace?.name, searchSpace?.description]);In prompt-config-manager.tsx (line 43):
The init effect uses searchSpace.qna_custom_instructions, but depends on [searchSpace]:
// Before
}, [searchSpace]);
// After
}, [searchSpace?.qna_custom_instructions]);In llm-role-manager.tsx (line 132):
The sync effect uses three specific preference IDs, but depends on [preferences]:
// Before
}, [preferences]);
// After
}, [preferences?.agent_llm_id, preferences?.document_summary_llm_id, preferences?.image_generation_config_id]);Acceptance criteria
- Effects only re-run when the specific properties they use actually change
- Settings forms still initialize correctly when data loads
- No ESLint
react-hooks/exhaustive-depswarnings
Reactions are currently unavailable