mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-09-13 04:04:09 +00:00
Fix #769: Resolve all react-hooks/set-state-in-effect lint errors project-wide
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user