Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

Fix GraphWorkspace infinite render loop by tracking stringified open panel IDs

Sameer6305eb8156ddb393
diff --git a/explorer/src/workspaces/GraphWorkspace/GraphWorkspace.tsx b/explorer/src/workspaces/GraphWorkspace/GraphWorkspace.tsx
index f055a3a3..db35bce9 100644
--- a/explorer/src/workspaces/GraphWorkspace/GraphWorkspace.tsx
+++ b/explorer/src/workspaces/GraphWorkspace/GraphWorkspace.tsx
@@ -2351,9 +2351,11 @@ export function GraphWorkspace({ externalFocusNodeId, externalFocusToken }: Grap
showPluginDock: openDockPanels.length > 0,
};
- const [prevOpenDockPanels, setPrevOpenDockPanels] = useState(openDockPanels);
- if (openDockPanels !== prevOpenDockPanels) {
- setPrevOpenDockPanels(openDockPanels);
+ const openDockPanelIdsString = openDockPanels.map((p) => p.id).join("|");
+ const [prevOpenDockPanelIdsString, setPrevOpenDockPanelIdsString] = useState(openDockPanelIdsString);
+
+ if (openDockPanelIdsString !== prevOpenDockPanelIdsString) {
+ setPrevOpenDockPanelIdsString(openDockPanelIdsString);
if (!openDockPanels.length) {
if (activeDockPanelId !== null) setActiveDockPanelId(null);
} else if (!activeDockPanelId || !openDockPanels.some((panel) => panel.id === activeDockPanelId)) {