Skip to content

Commit

Permalink
reduce layout re-render+
Browse files Browse the repository at this point in the history
  • Loading branch information
amcdnl committed Nov 13, 2024
1 parent 4e69e8c commit 07353f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/useGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ export const useGraph = ({
layoutMounted.current = false;
buildGraph(graph, visibleNodes, visibleEdges);
await updateLayout();
layoutMounted.current = true;
// rqf to prevent race condition
requestAnimationFrame(() => (layoutMounted.current = true));
}

update();
Expand Down

0 comments on commit 07353f1

Please sign in to comment.