monarchmoney / mint-export-extension

Effortlessly export your Mint data to CSV.
MIT License
36 stars 3 forks source link

Show progress if export is already running #50

Closed idpaterson closed 8 months ago

idpaterson commented 8 months ago

Balance and transaction exports continue to run in the background when the popup is closed or the back button is clicked as long as Mint is still open. However, the download buttons that you see on the main popup screen clear the existing state and start a new export. Now we have two balance exports running simultaneously and the progress bar jumps erratically between the first and second export job progress.

This pull request simply shows the progress screen for those download tasks if a job is already running. Since it is possible for a job to get hung up and never finish the extension will show the error screen after a certain period of inactivity. There is probably a more idiomatic way to accomplish that than a setTimeout(), but it works.

The "abandoned job" state can be tested easily with the unpacked extension.

  1. Start an export for all account balance history
  2. Go to chrome://extensions in a separate tab
  3. Press the reload button next to the extension which will kill the service worker but not reset the state
  4. Open the popup and wait for the error screen to appear