Skip to content

Conversation

@mrjo118
Copy link
Contributor

@mrjo118 mrjo118 commented Dec 3, 2025

This serves as an alternative to PR #13312. While not as comprehensive at warning the user about potential sync issues, this change helps reduce the possibility of the user getting note conflicts when using Joplin desktop.

Joplin desktop has a delay of 15 seconds before it automatically triggers the sync as a result of making a change to a note, in contrast to the mobile app which has a mere 1 second delay (the period is longer on desktop because the sync button is always visible and is distracting to some users if it is spinning too frequently). This means that if a user quits Joplin desktop without waiting 15 seconds after their last change and without clicking the sync button manually, they will get a conflict if they edited the same note another device without first returning to the original device.

This PR seeks to address this issue by opening a warning prompt upon quitting Joplin desktop, warning that not all changes have been synced, if a scheduled sync originally scheduled by an outgoing change has not yet completed. The prompt is a question dialog, which gives the user the option to either cancel quitting Joplin (so they can manually run the sync, or let it complete if in progress), or ignore the warning and quit anyway.

Implementation details

  1. Any outgoing changes which have not yet been synced which exist upon opening Joplin, will not trigger the warning
  2. This prompt will only be triggered when quitting Joplin via the File > Quit menu option, the keyboard shortcut to quit (ctrl+q / cmd+q), or the option to quit in the tray icon context menu. This is to avoid interfering with application restarts. The prompt will not be triggered by shutting down the OS or putting it to sleep / hibernating
  3. If the sync an eligible run of the sync is cancelled while in progress, the sync pending state will be cleared, and therefore will not prompt the user that not all changes have been synced when attempting to quit. The same applies when any kind of error is reported below the sync button, but this should already draw attention from the user and therefore not be much of an issue. The reason for not prompting the user in these cases is because if there is some kind of persistent error, it could become intrusive (and not useful) to the user if the prompt appears every time they quit Joplin
  4. If there are no outgoing changes to sync when the user manually triggers a sync, or when a full sync triggers at the user configured sync interval, then quitting Joplin while the sync is running will not trigger the prompt. This is by design, to avoid being intrusive to the user when it is not necessary. The prompt will only appear when a partial sync is scheduled or in progress, or when the sync is manually run by the user while a partial sync was scheduled

Testing

Testing has been done for the scenarios detailed in the implementation details above. Additionally, the following scenarios have been tested:

  1. When sync is set to none, the sync pending status is not set to true when changes are made, and therefore will not show the prompt
  2. When authentication for a sync target is not yet set up, the sync pending is not set to true when changes are made
  3. When the sync target is changed in the configuration, the sync pending status is reset
  4. When clicking no on the prompt, quit will be cancelled, when clicking yes on the prompt, Joplin will quit

See video demonstrating test cases for most of the above:

Joplin_hZvFrPqWty.mp4

@mrjo118 mrjo118 changed the title Desktop: Warn the user when not all changes have been synced before exiting Desktop: Warn the user when not all outgoing changes have been synced before exiting Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant