Skip to content

Commit

Permalink
Suppress even tho facebook/react#26395
Browse files Browse the repository at this point in the history
  • Loading branch information
duerdod committed Jul 13, 2023
1 parent 2c53b9e commit 91df930
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {
useRef,
useState,
useEffect,
useLayoutEffect,
useCallback,
useMemo,
Expand Down Expand Up @@ -81,6 +82,9 @@ function stylesForItem({

const lastKnownHeights = {} as Record<string, number | null>;

const useIsomorphicLayoutEffect =
typeof window !== 'undefined' ? useLayoutEffect : useEffect;

export function SnappyReactGrid({
id = 'default',
items,
Expand Down Expand Up @@ -173,7 +177,7 @@ export function SnappyReactGrid({
}
}, [updateItemVisibility, onScroll]);

useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
styleCache.current = {};
updateItemVisibility();

Expand Down

0 comments on commit 91df930

Please sign in to comment.