jaredLunde / jaredLunde/masonic
Rendered list items are reloaded sometimes when scrolling or resizing the window
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 63
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When using an iframe, video, or any web component with implicit state, scrolling or resizing the window (to cause the column count to change) can sometimes cause a complete re-render of a list item causing all the state to be lost.
Example using the default codebox with the first element changed into an iframe of Wikipedia:
https://codesandbox.io/s/masonic-example-forked-52xrvi?file=/src/index.js
Resizing the window such that the column count changes will cause the iframe to be completely reloaded, even though it is within the viewport the whole time.
I looked through the masonic code and it seems to be using key effectively which should prevent this issue but it's still happening. I also found this somewhat relevant issue: https://github.com/whatwg/html/issues/5484 though that seems to be about reparenting which should not be happening in this case.
**Desktop (please complete the following information):**
MacOS 12.3, Chrome v100, though we have been using Masonic for over a year and seen this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox reproduction and inspect the list rendering behavior during scrolling and column-count changes. Reproduce the iframe reload while it remains in the viewport; done means implicit state is preserved when scrolling or resizing causes a re-layout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100