Skip to content

Commit

Permalink
Fix thumbnails view lazy rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtcode committed Aug 29, 2024
1 parent 95b39ba commit 96eaa7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/components/sidebar/thumbnails-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function ThumbnailsView(props) {

useEffect (() => {
let options = {
root: containerRef.current,
root: document.querySelector('.sidebar-content'),
rootMargin: "200px",
threshold: 1.0
};
Expand Down
6 changes: 6 additions & 0 deletions src/pdf/pdf-thumbnails.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ class PDFThumbnails {
}

async render(pageIndexes = [], rerenderOnly) {
// If there are no thumbnails being rerendered due to annotation changes,
// clear the rendering queue to only render the thumbnails that were recently
// scrolled into view in the sidebar thumbnails view
if (!this._thumbnails.some(x => x.forceRerender)) {
this._renderQueue.end();
}
for (let pageIndex of pageIndexes) {
let thumbnail = this._thumbnails[pageIndex];
// Only already rendered thumbnails will be re-rendered, which means
Expand Down

0 comments on commit 96eaa7b

Please sign in to comment.