Repository navigation
fix: page mode toggle no longer overwrites default preference - #1996
Merged
Merged
Conversation
Yundi339
added a commit
to Yundi339/docmost
that referenced
this pull request
Apr 22, 2026
Upstream PR docmost#1996. Introduces a currentPageEditModeAtom that tracks the editor's mode for the current session. The header toggle updates this atom locally without persisting to the user profile, so clicking Edit/Read in the header no longer mutates the user's default page edit mode preference. The user's saved preference is still applied once per app session on first load via FullEditor.
Contributor
Author
|
@Philipinho Accidental edits happen often at my company and this change could really help. How can I help moving it forward? 🙂 |
The header edit/read toggle now controls only the current session's mode without saving it as the user's preference. The saved preference (set in profile settings) is applied once on initial load and sticks across page navigations within the session, so navigating to a new page no longer resets the mode mid-session. Fixes docmost#1693 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
julien-f
force-pushed
the
fix/editor-default-read-mode
branch
from
May 11, 2026 15:04
7981bef to
a671160
Compare
Member
|
Will revisit this. |
Yundi339
pushed a commit
to Yundi339/docmost
that referenced
this pull request
Jun 18, 2026
…t#1996) The header edit/read toggle now controls only the current session's mode without saving it as the user's preference. The saved preference (set in profile settings) is applied once on initial load and sticks across page navigations within the session, so navigating to a new page no longer resets the mode mid-session. Fixes docmost#1693 (cherry picked from commit 82d0656)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1693
The header edit/read toggle was calling
updateUseron every change, which overwrote the user's saved "Default page edit mode" preference. This meant navigating to any new page would inherit the last-used mode, making the preference setting ineffective.What changed
PageEditModeToggle) now updates only a session-local Jotai atom (currentPageEditModeAtom) without persisting to the server. A new component was introduced for this, leaving the existingPageStateSegmentedControl(used in profile settings) unchanged.PageEditor,TitleEditor) now react tocurrentPageEditModeAtominstead of reading the preference directly.currentPageEditModeAtomvia a module-level flag inFullEditor, so it survives component unmount/remount across page navigations.Resulting behaviour
This code was written by an AI assistant (Claude) and tested by a human, but has not been reviewed by an experienced developer. Please review carefully before merging, especially:
defaultEditModeAppliedflag infull-editor.tsxand its implications in edge cases (SSR, HMR, multiple tabs)PageEditModeTogglecomponent belongs inpage-state-pref.tsxor should live elsewhereTest plan
🤖 Written by Claude Code, tested by a human