Fix #769: Resolve all react-hooks/set-state-in-effect lint errors project-wide

This commit is contained in:
Sameer6305
2026-07-24 20:56:11 +05:30
parent adb46134c4
commit 343d2bc418
12 changed files with 298 additions and 90 deletions
@@ -2351,16 +2351,15 @@ export function GraphWorkspace({ externalFocusNodeId, externalFocusToken }: Grap
showPluginDock: openDockPanels.length > 0,
};
useEffect(() => {
const [prevOpenDockPanels, setPrevOpenDockPanels] = useState(openDockPanels);
if (openDockPanels !== prevOpenDockPanels) {
setPrevOpenDockPanels(openDockPanels);
if (!openDockPanels.length) {
setActiveDockPanelId(null);
return;
}
if (!activeDockPanelId || !openDockPanels.some((panel) => panel.id === activeDockPanelId)) {
if (activeDockPanelId !== null) setActiveDockPanelId(null);
} else if (!activeDockPanelId || !openDockPanels.some((panel) => panel.id === activeDockPanelId)) {
setActiveDockPanelId(openDockPanels[0].id);
}
}, [activeDockPanelId, openDockPanels]);
}
const viewModeItems = useMemo<GraphToolbarItem[]>(() => {
if (!hasGraphContent) {