Skip to content

Commit 22bc71e

Browse files
committed
remove unnecessary incorrect refresh check that tries to avoid refreshing if number of elements dont change
1 parent 2a255b7 commit 22bc71e

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

components/git-visualizer.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,17 +405,11 @@ export function GitVisualizer({
405405
}, [commits]);
406406

407407
// Re-run layout when commit set changes size to avoid race conditions during rapid branch switches
408-
const lastElementCountRef = useRef<number>(0);
409408
useEffect(() => {
410409
const cy = cyRef.current;
411410
if (!cy) return;
412411
const elementCount = elements.length;
413412
if (!elementCount) return;
414-
// Only run a fresh layout if number of nodes or edges changed significantly
415-
const shouldRelayout = elementCount !== lastElementCountRef.current;
416-
lastElementCountRef.current = elementCount;
417-
if (!shouldRelayout) return;
418-
419413
// Defer layout to next frame to ensure Cytoscape has applied React prop diff
420414
const frame = requestAnimationFrame(() => {
421415
const liveCy = cyRef.current;

0 commit comments

Comments
 (0)