Skip to content

Commit

Permalink
Fix(useVirtual): fix the randomly grid cells when working with dynami…
Browse files Browse the repository at this point in the history
…c size
  • Loading branch information
wellyshen committed May 23, 2021
1 parent b0b3421 commit 3fb42de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/hip-olives-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-cool-virtual": patch
---

Fix(useVirtual): fix the randomly grid cells when working with dynamic size
2 changes: 2 additions & 0 deletions src/useVirtual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ export default <
([{ borderBoxSize }]) => {
const { [itemSizeKey]: measuredSize } = borderBoxSize[0];

if (!measuredSize) return;

if (size !== measuredSize) {
measuresRef.current[i].size = measuredSize;
shouldRecalc = true;
Expand Down

0 comments on commit 3fb42de

Please sign in to comment.