Bug: PDF Viewer Window Title Not Updating When Dragging Same File
Description
When dragging and dropping PDF files in the PDF viewer application, the window title does not update correctly in the following scenario:
- Drag file
a.pdfinto the PDF viewer -> Title updates correctly - Drag file
b.pdfinto the PDF viewer -> Title updates correctly - Drag file
a.pdfagain into the PDF viewer -> Title remains asb.pdfeven though the content showsa.pdf
Steps to Reproduce
- Open the PDF viewer application
- Drag and drop
a.pdfinto the viewer - Drag and drop
b.pdfinto the viewer - Drag and drop
a.pdfagain into the viewer
Expected Behavior
The window title should update to reflect the currently displayed PDF file name, regardless of whether it's the same file being dragged again.
Actual Behavior
The window title remains stuck on the previous file name (b.pdf) even though the content has changed to show a.pdf.
Details
The issue appears to be in the title update logic in components/apps/PDF/usePDF.ts. The title update is dependent on the url state change, but when dragging the same file, the URL might not trigger a state update, causing the title to remain unchanged.
I am not sure why it did this for you but I am unable to re-create this. For me it updates every time. Did you drag each PDF from within the app or outside of it?
I am not sure why it did this for you but I am unable to re-create this. For me it updates every time. Did you drag each PDF from within the app or outside of it?
I add files to desktop, double click one to open, then drag and drop the second.
Scenario that probably cannot trigger the bug: If one PDF has metadata while the other doesn't. It will not reproduce.
(Edit: I also found for some PDFs with metadata, I cannot reproduce either. The key point seems to be metadata.title, not the whole metadata, but not sure yet.)
I can reproduce it on both your website and my local environment after about 3 times dragging and dropping.
Could you perhaps attach some example pdf's? I am not able to make this happen still, I tried 5 example pdf's which I downloaded.
I used these two PDFs. They can reproduce the bug on your website. Drag one into PDF viewer (or double click to open), then drag the other in. Do this twice. Let me know if you can reproduce or not.
I am able to reproduce some effect but it seems to be larger than the titles, the entire PDF is not loaded properly in some cases. I will dig further into this and also I have a long term plan to change how PDF loading works to be more efficent.
I've improved the loading logic so hopefully this fixes the issue.
https://github.com/DustinBrett/daedalOS/commit/0405c6ba7dec6a7706e188754d7c70ee0a38c7ba