-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$250] Attachments-PDF preview loads with delay, the grey line shown first #55671
Comments
Triggered auto assignment to @dylanexpensify ( |
Unable to reproduce. Can you confirm @IuliiaHerets? |
Hi, @dylanexpensify. QA team can still repro this issue, build - 89-5. Tester used Mac Chrome Recording.341.mp4 |
Job added to Upwork: https://www.upwork.com/jobs/~021883791423079955100 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rayane-djouah ( |
|
🚨 Edited by proposal-police: This proposal was edited at 2025-01-30 06:47:19 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.PDF attachments previews load with apparent delay, some grey lines are shown first. What is the root cause of that problem?The root cause is that the attachment display process is not hidden behind a loading spinner long enough to hide the display process What changes do you think we should make in order to solve the problem?We should use the same loading indication mechanism as for the other types of attachments For that, we should define a loading state in https://github.com/Expensify/App/tree/9.0.89-2/src/components/PDFView/index.tsx , meaning
We then define a function to manage the loading completion status
We then add the above function to the call to PDFPreviewer here App/src/components/PDFView/index.tsx Line 96 in d0b4943
as well as a condtionned display of a loading spinner, as such
and remove its LoadingComponent here App/src/components/PDFView/index.tsx Line 104 in d0b4943
In https://github.com/Expensify/react-fast-pdf/blob/1.0.22/src/PDFPreviewer.tsx we could then use onLoadComplete function like this
which will then be passed to the PageRenderer here as following
https://github.com/Expensify/react-fast-pdf/blob/1.0.22/src/PageRenderer.tsx will then use it as following
That function will then be called when the display of each page is done by adding it as onRenderSuccess prop here as following
RESULTIt works like a charm fixworks.mp4What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?None What alternative solutions did you explore? (Optional)None |
@rayane-djouah to review! |
@dylanexpensify, @rayane-djouah Whoops! This issue is 2 days overdue. Let's get this updated quick! |
@Kalydosos, the root cause isn’t fully clear from your proposal. Could you clarify what’s specifically causing the delay in the PDF preview loading and the appearance of the grey line? Also, could you explain what the current loading indicator logic is doing and how it leads to this issue? |
@rayane-djouah there is no delay in fact, it's the normal rendering process except that there is no loading spinner mask hidding the process. And the original cause is that because of a previous bug we dont provide a spinner to react-pdf to hide the rendering process the way it expected as you can see below : the spinner provided to react-pdf here should be provided also through pagerenderer here but it's not due to the mentionned issue. but react-pdf version have been changed here which triggers this spinner issue again, the bottom line being that the current loading spinner mechanism relying on react-pdf (and due to the aforementioned issue) is not suffiscient to hide the whole rendering process and maybe we dont wish to tweak react-pdf so we should use instead our classical loading spinner mechanism like for other types of attachments |
@dylanexpensify, @rayane-djouah Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Sorry for the delay; I was sick at the end of last week. I'll review the issue today. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@Kalydosos Thanks for the explanation. I investigated this issue, and as you mentioned, the root cause appears to be related to passing an empty Observations:
![]()
![]() Proposed Fixes:
What do you think? Could you update your proposal accordingly? |
Also cc-ing @rezkiy37 for thoughts as he worked on multiple |
Hi,
This is expected behavior now. We have reverted a couple of PRs recently for |
@rezkiy37 thanks for your feedback. So you will still use the legacy version for users under 18, the problem wont persist in that case ? FYI, i did the tests on Chrome which seems also impacted |
Yes.
Yes, it’s correct because it’s not separated by Chrome or Safari. Currently, the app utilizes the legacy one for all browsers and the desktop. |
@rayane-d to confirm |
@rezkiy37 Thanks for reviewing! I tried resetting the history locally to the commit 23c4e87, which is just before f71f36e (where #55421 was merged). However, I’m still able to reproduce the issue. It seems the issue persists even with the latest PDF.js worker. Am I missing something? Screen.Recording.2025-02-05.at.11.52.56.PM.mov |
@dylanexpensify @rayane-d this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
Let me take a look 👀 |
@rayane-d Yeah, you are right. It does not care about the worker. Therefore this issue makes sense. Recording.mp4 |
@rezkiy37 Thanks for confirming! |
@Kalydosos Any thoughts on #55671 (comment)? |
@rayane-d the grey outlines seems related to the viewports of the currently displayed pages. Their widths are adjusted progressively in the rendering process. i think maybe @rezkiy37 can tell us best if we can ensuring proper width/height calculations
trynotemptyloaderprop.mp4I've tried that but the issue still occur. I've passed to PageRenderer the same LoadingComponent (a modified version) passed to Document in PDFPreviewer https://github.com/Expensify/react-fast-pdf/blob/a66e51945117e89956e5aea9be5cf7d3cc29d269/src/PDFPreviewer.tsx#L232 |
If you don't mind, I can work on this issue and figure it out. |
Hi, I am Michael (Mykhailo) from Callstack, an expert agency and I can work on this issue. |
that will be nice @rezkiy37 but i will somehow advise that for consistency we set up a loading spinner managment in App instead of in react-fast-pdf like in my proposal so we can anticipate changes and constraints (like offline status) better and in the same manner as for other types of attachments. Per example, we display the default attachment (an icon and the filename), when offline and cache is disabled, instead of the offline status notice as for other types of attachments. What do you think @rayane-d ? |
@dylanexpensify, @rayane-d Whoops! This issue is 2 days overdue. Let's get this updated quick! |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
As I mentioned in this comment, my preference would be to address this issue within
I think this was a design choice and is currently intended behavior. |
@dylanexpensify Friendly bump on #55671 (comment) |
Nice, I am working on the issue tomorrow. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.89-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/cases/view/2654655
Issue reported by: Applause Internal Team
Device used: MacBook Air 14.1 Chrome
App Component: Chat Report View
Action Performed:
Expected Result:
PDF preview is opened without delays
Actual Result:
PDF preview loads with delay, the grey line shown first
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/26996e5f-8eb4-4e66-8ad0-1890d76162b4
https://github.com/user-attachments/assets/ac4dc41b-73f7-4ad8-9d29-dd1ee94bb6fa
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @rayane-djouahThe text was updated successfully, but these errors were encountered: