Skip to content

Commit

Permalink
Update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
blambillotte committed Dec 20, 2024
1 parent 7e9ec31 commit 3398597
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/Table/utils/GridRowLookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ export function shouldSkipScrollTo(
if (!virtuosoRangeRef.current || forceRescroll) return false;

const isAlreadyInView =
// Add 1 on each end to account for "overscan" where the next out of view row is usually already rendered
// Add 1 on each end to account for "overscan" where the next out of view row is usually already rendered. This isn't a perfect solution,
// but our current "overscan" is only set to 50px, so it should be close enough and the library recommended alternative of adding an
// intersection observer to each row seems like a not worth it performance hit (https://github.com/petyosi/react-virtuoso/issues/118)
index >= virtuosoRangeRef.current.startIndex - 1 && index <= virtuosoRangeRef.current.endIndex + 1;

console.log({ index, virtuosoRangeRef: virtuosoRangeRef.current, isAlreadyInView });

return isAlreadyInView;
}

0 comments on commit 3398597

Please sign in to comment.