SurfSense/surfsense_web/components/settings
guangyang1206 345cb88224 refactor(settings): use key prop to reset LLM role manager form state
Fixes #1018

Remove the sync useEffect that copied preferences into local state,
along with the savingRef guard that prevented mid-save overwrites.
Instead, pass key={searchSpaceId} on the LLMRoleManager component so
React remounts the form with correct initial state whenever the search
space changes — no extra re-render, no effect dependency array.

Changes:
- llm-role-manager.tsx: remove useEffect + useRef + savingRef pattern;
  drop useEffect and useRef from imports (now only useCallback, useState)
- search-space-settings-dialog.tsx: add key={searchSpaceId} to
  <LLMRoleManager> so the component remounts on search-space change

Before: useEffect synced preferences → assignments on each preference
  update, with savingRef to avoid overwriting an in-flight save.
After:  React remounts the component with correct initial state from
  the preferences selector; no mid-save race possible.
2026-04-29 12:34:14 +08:00
..
agent-model-manager.tsx refactor: replace MessageSquare with MessageCircleReply across various components 2026-04-25 15:12:22 +05:30
buy-pages-content.tsx chore: linting 2026-03-31 21:42:03 -07:00
buy-tokens-content.tsx feat: no login experience and prem tokens 2026-04-15 17:02:00 -07:00
general-settings-manager.tsx feat: add maxLength constraints to auth and settings form inputs 2026-04-16 22:33:01 +08:00
image-model-manager.tsx refactor: replace MessageSquare with MessageCircleReply across various components 2026-04-25 15:12:22 +05:30
llm-role-manager.tsx refactor(settings): use key prop to reset LLM role manager form state 2026-04-29 12:34:14 +08:00
more-pages-content.tsx feat: implement download functionality for different OS in SidebarUserProfile and DownloadButton components, enhance user experience with localized download messages 2026-04-10 19:53:13 +05:30
prompt-config-manager.tsx chore: linting 2026-03-31 14:45:46 -07:00
roles-manager.tsx refactor: replace MessageSquare with MessageCircleReply across various components 2026-04-25 15:12:22 +05:30
search-space-settings-dialog.tsx refactor(settings): use key prop to reset LLM role manager form state 2026-04-29 12:34:14 +08:00
settings-dialog.tsx chore: ran linting 2026-03-17 04:40:46 +05:30
team-dialog.tsx chore: ran linting 2026-03-21 13:20:13 +05:30
team-memory-manager.tsx refactor(icons): replace 'Pen' icon with 'Pencil' across various components for consistency 2026-04-24 02:33:57 +05:30
user-settings-dialog.tsx Align connectors, editors, and layout with desktop context 2026-04-24 19:19:04 +02:00
vision-model-manager.tsx refactor: replace MessageSquare with MessageCircleReply across various components 2026-04-25 15:12:22 +05:30