Skip to content

Fix Virtualizer infinite loop for height 0#6497

Merged
snowystinger merged 7 commits into
mainfrom
fix-virtualizer-infinite-loop
Jun 11, 2024
Merged

Fix Virtualizer infinite loop for height 0#6497
snowystinger merged 7 commits into
mainfrom
fix-virtualizer-infinite-loop

Conversation

@snowystinger
Copy link
Copy Markdown
Member

Closes #6298
Alternative to #6357
I believe the issue is that in our layouts, we were calling isVisible which checked if the layoutInfo intersects with the visible rect. This always came back as true when the height was 0 because with the display hidden, everything was 0,0. I could fix it in isVisible, but then we have to remember it for all other layouts. Instead, in Virtualizer, we just don't fetch any layout infos or do any detection if the height is 0. I don't think we'll want to render anything if the height is 0 anyways, so this should be fine.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@rspbot
Copy link
Copy Markdown

rspbot commented Jun 5, 2024

Comment thread packages/@react-stately/virtualizer/src/Virtualizer.ts Outdated
@rspbot
Copy link
Copy Markdown

rspbot commented Jun 5, 2024

Comment thread packages/@react-spectrum/list/stories/ListView.stories.tsx Outdated
Copy link
Copy Markdown
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, happy to approve as is as well

Comment thread packages/@react-spectrum/list/stories/ListView.stories.tsx Outdated
@rspbot
Copy link
Copy Markdown

rspbot commented Jun 7, 2024

@rspbot
Copy link
Copy Markdown

rspbot commented Jun 7, 2024

@rspbot
Copy link
Copy Markdown

rspbot commented Jun 7, 2024

@rspbot
Copy link
Copy Markdown

rspbot commented Jun 11, 2024

@rspbot
Copy link
Copy Markdown

rspbot commented Jun 11, 2024

## API Changes

unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }

@snowystinger snowystinger merged commit ddb63ae into main Jun 11, 2024
@snowystinger snowystinger deleted the fix-virtualizer-infinite-loop branch June 11, 2024 20:01
@snowystinger snowystinger mentioned this pull request Jun 17, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting "display:none" on ListView parent crashes the page

5 participants