Skip to content
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

Virtual Scroller loads 9x as much as is visible at any one time. #12049

Closed
miquels opened this issue Jan 14, 2022 · 2 comments
Closed

Virtual Scroller loads 9x as much as is visible at any one time. #12049

miquels opened this issue Jan 14, 2022 · 2 comments
Labels
area/components bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-webpack kind/bug 🐞 Qv2 🔝 Quasar v2 issues

Comments

@miquels
Copy link

miquels commented Jan 14, 2022

What happened?

I've built a 'ThumbWall' component. It shows movie posters. Each row is 8 movie posters. The screen can show a maximum of 3 rows, so 24 posters on the screen. But QVirtuaScroll insists on loading 30 rows, that's 240 images. The documentation states:

The number of items that will be rendered will be calculated based on the virtual-scroll-item-size prop and the size of the scrollable area, but you can fit it to your needs using the virtual-scroll-slice-size prop.

Hoever, the component does not seem to calculate this correctly and appears to ignore the virtual-scroll-slice-size prop.

What did you expect to happen?

I expected the VirtualScroll component to preload maybe 3 rows or so (a screenful), and for it to obey the virtual-scroll-slice-size prop.

Reproduction URL

https://codepen.io/miquels/pen/GRMPpLg?editors=1111

How to reproduce?

  1. Go to the provided production link.
  2. See that the virtual-scroll-slice-size prop is set to 5
  3. Notice that the number of rows in the DOM is 30

Flavour

Quasar CLI (@quasar/cli | @quasar/app)

Areas

Components (quasar)

Platforms/Browsers

Chrome

Quasar info output

No response

Relevant log output

No response

Additional context

No response

@miquels miquels added kind/bug 🐞 Qv2 🔝 Quasar v2 issues labels Jan 14, 2022
@github-actions github-actions bot added area/components bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-webpack labels Jan 14, 2022
@pdanpdan
Copy link
Collaborator

The computation is a bit more complicated:

  • the base (on screen) minimum number of rows is 10
  • then we use virtualScrollSliceRatioBefore and virtualScrollSliceRatioAfter to add more rows before of after

So you can reduce the number of rows by setting these props to a smaller ratio (like 0.2)
https://codepen.io/pdanpdan/pen/zYEeqwY?editors=1111
About the minimum base size I have to think, so please be patient

@rstoenescu
Copy link
Member

Fix will be available in Quasar v2.4.11 and v1.17.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/components bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-webpack kind/bug 🐞 Qv2 🔝 Quasar v2 issues
Projects
None yet
Development

No branches or pull requests

3 participants