Fix for #296: Insert the virtual component bound back to DOM also for the case shouldRecycle=false#479
Conversation
0f591a2 to
8ca0edc
Compare
shouldRecycle=true
|
I think this should be quite uncontroversial. Pinging the ones I know have touched upon this issue before: @ahamedalthaf @Atrue @runspired @mixonic, as this seems to have had some history😅 please chip in if you see something concerning, or if you think it is ready for merge, thanks! |
shouldRecycle=trueshouldRecycle=false
| for (let i = _componentPool.length - 1; i >= 0; i--) { | ||
| const component = _componentPool[i]; | ||
| const item = objectAt(items, component.index); | ||
| if (shouldRecycle === true && item) { |
There was a problem hiding this comment.
On the last PR that worked on fixing this I'd left this comment for future follow up:
I think we should follow up with a check for whether we are in the document-fragment or still in the DOM, if we are not in the fragment there's no reason to re-insert in this way.
I suspect that might still be true but I'd need to sit down and reason through the code. The worst that could happen merging this as is I believe is that we just move some DOM "in-place" which isn't too big a deal.
|
@johanrd would you be willing to rebase this PR since the repo is now a v2 addon? <3 |
5fa1db9 to
8cd0514
Compare
0c38fd4 to
e73f799
Compare
|
@NullVoxPopuli thanks! done👍 |
Fix for #296 race condition with
shouldRecycle=falseduring fast scroll.The issue was that we had 'forgotten' to apply the fix 'Insert the virtual component bound back before removal to make sure Glimmer not confused about the state of the DOM.' also to the case
shouldRecycle=true.I was able to reproduce with scrolling fast up and down with the following component:
Here the scroll window was 350 px height, it is more reproducible when it is small, and scrolling up and down very quickly:
Screen.Recording.2025-10-03.at.22.55.31.mov