Repository navigation
Ticket-672: Fix blank PDF until window resize - #8231
Merged
Merged
Conversation
Collaborator
Coverage Report for CI Build 39974016134Coverage increased (+0.002%) to 91.049%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
Collaborator
Coverage Report for CI Build 39974050132Coverage increased (+0.002%) to 91.049%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
donny-wong
approved these changes
Oct 24, 2026
david-yz-liu
approved these changes
Oct 27, 2026
david-yz-liu
left a comment
Collaborator
There was a problem hiding this comment.
Nice work @Naragod!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
This fixes a blank PDF in the grading view. The page stays blank until the grader resizes the window. David asked to split #8228 in two. This PR holds the blank PDF fix.
The viewer hides itself while a file loads. pdf.js draws the pages a person can see. In a hidden pane, pdf.js finds zero pages to draw. A PDF with one page, such as a cover page, finishes while the pane is still hidden. The page then stays blank until a window resize forces a redraw.
In the code,
file_viewer.jsxsetsdisplay: nonewhile it loads. pdf.js firespagesloadedbefore the pane shows.update_pdf_viewthen skips the refit.pdf_viewer.jsxnow watches its pane with aResizeObserver.pdfViewer.update()to draw the pages in view.Verification
We ran these checks in Chromium on a local scanned exam. We ran them before the split, with the #8230 fix in place too.
Screenshots of your changes (if applicable)
Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]into a[x]in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
pdf_viewer.jsx. Git merges them clean in either order.