Skip to content

Desktop: Fixes #16099: Skip the note lock session effect on the first render - #16100

Merged
laurent22 merged 2 commits into
laurent22:devfrom
keshav0479:gsoc-local-note-encryption-mount-refresh
Jul 31, 2026
Merged

Desktop: Fixes #16099: Skip the note lock session effect on the first render#16100
laurent22 merged 2 commits into
laurent22:devfrom
keshav0479:gsoc-local-note-encryption-mount-refresh

Conversation

@keshav0479

Copy link
Copy Markdown
Contributor

Fixes #16099

The session change effect in useFormNote checks the previous value against undefined, but usePrevious starts its ref at null, so it never skips the first render and refreshes the note on mount. Seeding usePrevious with the current value makes the first render compare equal, and the undefined check goes with it since there's no sentinel left to guard against. Real session changes still refresh as before.

The test also waits for its own setup save to flush, so that change event can't reach the hook's listener and reload the note mid-test.

Ran yarn tsc and the app-desktop suite. Note.load calls on mount went from 4 to 2 with note lock on and an editor plugin active.

I used AI tools on this PR for code suggestions and review, and reviewed and tested the changes myself.

@coderabbitai coderabbitai Bot added bug It's a bug desktop All desktop platforms labels Jul 30, 2026
keshav0479 added a commit to keshav0479/joplin that referenced this pull request Jul 30, 2026
@joplin-coderabbit-cleanup joplin-coderabbit-cleanup Bot deleted a comment from coderabbitai Bot Jul 30, 2026
@coderabbitai coderabbitai Bot added the performance Performance issues label Jul 31, 2026
@joplin-coderabbit-cleanup joplin-coderabbit-cleanup Bot deleted a comment from coderabbitai Bot Jul 31, 2026
@laurent22
laurent22 merged commit 5395a8d into laurent22:dev Jul 31, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug It's a bug desktop All desktop platforms performance Performance issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Note lock session effect refreshes the note on the first render

3 participants