Skip to content

Commit e033d8c

Browse files
committed
Wrap navigate with a useCallback
1 parent e667514 commit e033d8c

File tree

1 file changed

+9
-6
lines changed
  • rust/cubesql/cubesql/egraph-debug-template/src

1 file changed

+9
-6
lines changed

rust/cubesql/cubesql/egraph-debug-template/src/index.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,15 @@ const LayoutFlow = () => {
338338
setPreNodesEdges({ preNodes: newNodes, preEdges: newEdges });
339339
};
340340

341-
const navigate = (id) => {
342-
zoomTo(fitView, [id]);
343-
if (!navHistory.includes(id)) {
344-
setNavHistory(navHistory.concat(id));
345-
}
346-
};
341+
const navigate = useCallback(
342+
(id) => {
343+
zoomTo(fitView, [id]);
344+
if (!navHistory.includes(id)) {
345+
setNavHistory(navHistory.concat(id));
346+
}
347+
},
348+
[fitView, navHistory],
349+
);
347350

348351
const nodeTypes = useMemo(
349352
() => ({

0 commit comments

Comments
 (0)