knowledge icon indicating copy to clipboard operation
knowledge copied to clipboard

[Bug]: App force-reloads when PDFs are moved or cannot be found

Open RobRoyce opened this issue 2 years ago • 1 comments

Issue: if a PDF is moved from its original location, and the user attempts to open the Details view, the app force-reloads (losing any unsaved work). This error is already handled explicitly here, but by that point, it is too late, and the app is already in an inconsistent state (and therefore requires a reload).

Steps to recreate:

  1. Import any PDF
  2. Move it from its original location on disk
  3. Attempt to access the Details view

Solution 1: Perform a check before attempting to display files. If the file no longer exists, do the following:

  • Prompt the user to locate it (assuming they know where it has been moved to)
  • If the user does/can not locate it, ask if they want to:
    • Disable the preview feature for that particular Source
    • Remove the Source entirely

Caveats:

  • If we do allow the ability to keep a Source when a file is moved, we must either:
    • Add a flag to the SourceModel saying the preview should be disabled. This will involve additional overhead and house keeping, or
    • Create a "blacklist" of Sources that are not allowed to be previewed (easier and less overhead, but not very elegant)
  • If we do not allow the ability to keep a Source when a file is moved, the user risks losing valuable data. This should be handled gracefully if possible (prompt the user to export any associated data before removing the source)

RobRoyce avatar Feb 21 '23 19:02 RobRoyce

I think it would be easier to just check for the file dynamically. If it can't be loaded, just don't show the preview bar in details (or display a small error saying the file can't be located)

RobRoyce avatar Mar 23 '23 01:03 RobRoyce