Skip to content

Desktop, Mobile, Cli: Fix note screen is not properly refreshed when updated by the sync, when E2EE is enabled - #16179

Open
mrjo118 wants to merge 4 commits into
laurent22:devfrom
mrjo118:fix-refresh-on-sync-update-with-e2ee
Open

Desktop, Mobile, Cli: Fix note screen is not properly refreshed when updated by the sync, when E2EE is enabled#16179
mrjo118 wants to merge 4 commits into
laurent22:devfrom
mrjo118:fix-refresh-on-sync-update-with-e2ee

Conversation

@mrjo118

@mrjo118 mrjo118 commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

PR #16150 fixed an issue whereby the note viewer / editor on mobile does not get refreshed upon the open note being updated via the sync. However, this caused a regression, as it turns out the existing shared.reloadNote function does not actually work properly with notes which still have E2EE applied (which is the case immediately after a change is synced), and it simply displays a blank note viewer / editor if refreshed immediately after syncing an update to the note, where E2EE is enabled.

This PR addresses the issue by decrypting the note immediately upon reloading the note, and waiting for the decryption to complete before updating the screen. Additionally, the DecryptionWorker has been amended to avoid decrypting and re-saving the note if the latest version of the note has the encryption removed, since decrypting other items in the decryption loop. This is in order to prevent a race condition which could cause content in the editor to be lost, if the decryption worker is running slowly and takes a while to reach the note which was already decrypted. This also aids PR #16023 which also makes use of on demand decryption of E2EE encrypted notes, which will prevent the decryption worker from potentially overwriting an automatically resolved conflict.

Testing

In order to test the DecryptionWorker change, I artifically added delays for both the on demand decryption and before starting the inner loop of the DecryptionWorker after selecting the items for decryption. Using these changes locally, I could produce this race condition which I verified from the log that this occurred and did not cause any issues.

Video demonstrating the issue when a conflict refreshes the note with E2EE enabled, before the change:

Screen_Recording_20260809_234949_Joplin2.mp4

Demonstrating the issue resolved, after the change:

Screen_Recording_20260810_000501_Joplin2.mp4

@coderabbitai coderabbitai Bot added the bug It's a bug label Aug 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Comment thread packages/lib/components/shared/note-screen-shared.ts Outdated
@joplin-coderabbit-cleanup joplin-coderabbit-cleanup Bot deleted a comment from coderabbitai Bot Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug It's a bug v3.7

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant