Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(template): fix initialScrollIndex in AutoSizeVirtualScrollStrategy #1787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 3, 2024

Conversation

hoebbelsB
Copy link
Member

@hoebbelsB hoebbelsB commented Sep 28, 2024

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

@github-actions github-actions bot added </> Template @rx-angular/template related πŸ”¬ Experimental Experimental: Feature, docs, demos labels Sep 28, 2024
Copy link

nx-cloud bot commented Sep 28, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit cc26bcd. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

πŸ“‚ See all runs for this CI Pipeline Execution


βœ… Successfully ran 7 targets

Sent with πŸ’Œ from NxCloud.

@hoebbelsB hoebbelsB merged commit a0b7f11 into main Oct 3, 2024
11 checks passed
@hoebbelsB hoebbelsB deleted the fix-scrollpos branch October 3, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
πŸ”¬ Experimental Experimental: Feature, docs, demos </> Template @rx-angular/template related
Projects
None yet
1 participant