fix(template): fix initialScrollIndex in AutoSizeVirtualScrollStrategy #1787
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
initialScrollIndex scroll-up rendering bug
In cases where we set an
initialScrollIndex
that leaves out some views in the beginning as initial paint - e.g. the range is something like 3:28. Subsequent scroll up events lead to a weird scroll behavior.rxFor creates the new views (+ attaching them as children to the DOM). The layout is now unstable - new nodes were added. Next, the scroll strategy asks for the dimensions of the newly created nodes which triggers a forced reflow - the layout will be stabilized. Before the scroll strategy does set position: absolute, chrome already rendered the node as position: relative, increasing the size of the scroll viewport and pushing down other nodes.
That's how the scroll position gets weirdly out of sync.
Fixes #1783
initialScrollIndex scroll-up rendering bug
Setting an initialScrollIndex could lead to a situation where the scrollPos is calculated before the container is fully rendered and the resizeobserver emitted a size for it. That means the calculated range is 0:0 - as there is no space available.
Fixes #1779