-
Notifications
You must be signed in to change notification settings - Fork 736
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
feat: update to vue-virtual-scroller 1.1.2 #11671
feat: update to vue-virtual-scroller 1.1.2 #11671
Conversation
Hi @ThEditor. Thanks for your contribution! 🎉 Could you please retarget the PR and rebase to the Also, you can add your name and GH User on the AUTHORS.md file. 🎉 |
I think that should have done it. Thanks again @AlexVelezLl ! |
Build Artifacts
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thank you @ThEditor! Code looks good, but I have encountered some problems:
-
The pdf renderer now presents some performance issues since it now loads some more pages and it renders the same page several times.
- The loading of several pages could be due to the change on the
buffer
prop, and probably it could be easily handled and discussed what can be the optimal value. - But what has the biggest impact on performance is that the list renders each page 3 times on the first render and on every new item that is shown while the user scrolls. This leads to jumps and flashes on the document.
I measured performance of the page rendered task before and after the update, and after the change there was some situations where it shows some overflow on some pages although this pdf has the same height for all pages:
Before:
PdfRendererBefore.mp4
After:
PdfRendererAfter.mp4
It seems it is because vue-scroller internally mount each page Component some additional times to get the item height. But we dont need to mount the pdf page Component to get its height, since its height is defined by the page height, the zoom and margin and it can be calculated without mounting the component.
We can maybe look at the library to see if we can provide the height of an item without mounting the component multiple times, since this operation is expensive. Another solution that comes to my mind is to try to render like a "centinel node" that can provide to the DynamicScroller the height without doing the expensive tasks that the PdfPage Component does on mount.
- The loading of several pages could be due to the change on the
-
Also, it seems that now the RecycleList component does not expose the
updateVisibleItems
methods, and this method fails.
/> | ||
<DynamicScrollerItem | ||
:item="item" | ||
:active="active" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this active
and index
attributes are not defined here. You need to define them in the template
above:
<template #default="{ item, index, active }">
...
</template>
:emitUpdate="true" | ||
:buffer="1.5 * itemHeight" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can live without this additional buffer prop for now. Pdf pages are usually full of content, and probably the user will keep viewing the current page for some time, so we dont need to load 2 pages below meanwhile.
:item="item" | ||
:active="active" | ||
:sizeDependencies="[ | ||
item.height, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Item.height is undefined here, as the items of the is are the pdfPages
array, and each item has this structure:
{ page: null, resolved: false, index: i, }
I'm not sure if I understand correctly. We have a pdf document of pages with unknown heights and that's why we try to utilize I also don't understand how we know the height of an item without actually rendering it? Does the page property expose a height field? Aren't zoom, margin set according to the |
So, I looked into this further. I tried searching for other libraries, tried implementing infinite scrolling on my own, but ended up back to
I haven't made this into a commit yet because I'm not sure if this is even the right implementation (it works though). I would be interested in a meet, if possible, to discuss this issue, @AlexVelezLl . Thanks again! (also, merry christmas! :D) |
Hi! @ThEditor. Hope you had a merry christmas! and a happy new year 👐. Ill let there some responses but probably will see deeply on new year:
The height of a page can be obtained with (here we calculate it):
pageHeight can be obtained using the So, as you can see, we dont need the page to be rendered (
For what I see, I think You can push your changes and after the holidays I can review it, and have a meet if needed! :)
We could probably fill all pages with the |
Oh, that reply sounds exactly like what I implemented in the most recent commit(s). I'm not home right now, I'll push the code as soon as possible. @AlexVelezLl (hope you had an awesome christmas and new year too!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general it is looking amazing! The vue-virtual-scroller update has bring much more smooth scrolling, and it now renders the items in order in the DOM, just let some thoughts on things that can impact the performance.
kolibri/plugins/pdf_viewer/assets/src/views/PdfRendererIndex.vue
Outdated
Show resolved
Hide resolved
kolibri/plugins/pdf_viewer/assets/src/views/PdfRendererIndex.vue
Outdated
Show resolved
Hide resolved
I wasn't sure if these changes are "acceptable", and hence, I didn't implement some changes/ideas I had. Now that I know these are okay, I can proceed. I'll get back to you on these changes as soon as possible. |
I've made the requested changes, this should be ready for review again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! It is pretty exicitng 🎉🎉🎉 . We are almost done! Just one last very little thing from my side is that this node from the internals of the recycle list is taking some space and it shouldn't. We need to avoid it, and also fix a failed check in the code formatting, but everythnig else is looking fine!
Code looks good and some refactor you have done makes the code more readable! Thanks! This PR also solves a bug we had in the pages order in the DOM 👐. I will let the final approve to @radinamatic.
kolibri/plugins/pdf_viewer/assets/src/views/PdfRendererIndex.vue
Outdated
Show resolved
Hide resolved
The space is due to
Making the change would require me to also pull in these files into the project. @AlexVelezLl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ThEditor, thank you for your contribution. While testing I noticed the following issues:
- Scrolling is no longer working when viewing the pdf-s in a mobile browser (tested both with actual device and Chrome's dev tools).
2024-01-08_18-14-27.mp4
- Sometimes the completion modal is not being displayed after having completed reading the pdf (perhaps that's because of the extra padding at the bottom?).
2024-01-08_18-19-21.mp4
I am a bit busy for a few days, I'll get back to you as soon as possible. |
Investigated the scrolling issue a bit, broken since ec1d3a3. Looking into it. |
Does this look correct? or did I mess up? 😅 @AlexVelezLl |
Yes! That's exactly how it should look @ThEditor 😃. Just noted that a linting check failed hehe, Would be good If you can pass the lint again and update the pr ^^. |
Yeah, I'll try fixing the linting issues. I can't seem to get pre-commit to install locally, hence why code with lint issues. |
Please @ me when you guys have reviewed this, thanks! |
Hello @ThEditor! Thanks for your patience, we will do a final QA review but it won't be merged until 0.16 Kolibri version is released (which should happen in a few weeks). We will keep in touch 👐. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ThEditor - the scrolling issue in mobile devices is fixed now and I didn't observe any regression issues - good to go!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manual QA passed, good to go! 💯 👏🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all your hard work here! @ThEditor 🎉 👐. I've given the code a final check and it looks good! It is ready to go now that 0.16.0 have been released! 🎉 🎉 🎉
3b37b81
into
learningequality:release-v0.16.x
Thanks a lot for merging! Glad to be able to contribute. |
Summary
[ ] Fit to width dynamically/provide a button(Out of scope)preview.mp4
References
Closes #11663
Dependency diff:
Reviewer guidance
Open any pdf document inside kolibri
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)