-
-
Notifications
You must be signed in to change notification settings - Fork 226
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
Add virtual scroller to library view #119
Conversation
v-img appears to be very slow, which makes the rendering of the cards sluggish. This replaces it with a normal img and uses the transition group to perform the fade in, making the component a lot faster.
Would it be possible to preserve the scroll location when navigating backwards? This is a point that many virtual strollers implement wrong and for large libraries it really makes it painful and unintuitive to use. |
The virtual scroller now uses the windows's height times 1.5 as the size of the buffer. This loads 13 rows of 8 items on a 1920x1080 screen, further reducing pop-in when scrolling fast. The multiplier is expected to be adjusted through testing on more devices down the line.
This should be possible, but there are some considerations:
This definitely needs some improvement, for sure. It's probably something we'll be adjusting and optimizing as we go along. All the items in the library are actually pre-fetched, we don't do any lazy-loading. What's happening here is that the virtual scroller is having a hard time keeping the cards updated with your scrolling. Do note that running this in dev mode ( I have adjusted the buffer to be reactive with the window height and load more items, which now brings the total of rendered rows to 13, so 104 items. This should alleviate the issue for now, but keep in mind it'll be a balancing act for a while, as we test this on more and more devices. |
During the move to BlurhashImage, a CSS property for fitting the image properly was lost. This restores it, fixing the aspect ratio issues on card images.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
To get around the limitations of the virtual scroller not supporting grids, we use lodash's
chunk
function to transform the items array with chunks of items (the length of which depends on the breakpoint we're at).This essentially gives us a bunch of rows of items to pass to the virtual scroll, simulating a grid.
The current implementation of BlurhashImage was somewhat slow in this scenario, so I switched the library to use
blurhash-wasm
, which is a Web Assembly decoder in Rust (@sparky8251 will be happy 😄 ).Further performance issues lead to a profiling of the view and I discovered that
v-img
is quite slow in this scenario. I replaced it withimg
, since we're not using the features ofv-img
in this case, which gives us a significant performance boost.