Skip to content

fix: reconcile direct-edit and plain-edit baselines to avoid false conflict dialog - #3271

Open
mvanhorn wants to merge 1 commit into
nextcloud:mainfrom
mvanhorn:fix/2196-direct-edit-plain-edit-conflict
Open

fix: reconcile direct-edit and plain-edit baselines to avoid false conflict dialog#3271
mvanhorn wants to merge 1 commit into
nextcloud:mainfrom
mvanhorn:fix/2196-direct-edit-plain-edit-conflict

Conversation

@mvanhorn

Copy link
Copy Markdown

Switching a note between plain edit and rich (direct) edit repeatedly no longer triggers the Text editor's "The document has been changed outside of the editor" conflict dialog when the user made no changes.

Reported in #2196 and confirmed by multiple reporters from app version 4.2.1 (2024) through a fresh reproduction on 2026-06-30. Switching modes two or more times reliably surfaced the conflict dialog ("Use current version" / "Use the saved version") even with no content change, because the plain editor and the server-side Text (direct edit) app each carried their own baseline and a mode switch made one look stale to the other. On opening a note, the two paths now reconcile against the same saved baseline before the editor loads, so an unmodified mode switch is not treated as an outside change; the dialog still fires for genuine outside edits.

Fixes #2196

🖼️ Screenshots

No UI change — this fixes an incorrect conflict dialog that appeared during plain/rich edit mode switches. The dialog itself is unchanged; it simply no longer fires on an unmodified note.

🏚️ Before 🏡 After
Conflict dialog appears after toggling plain/rich edit on an unchanged note No dialog on an unchanged note; genuine outside edits still raise it

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@alperozturk96

Copy link
Copy Markdown
Collaborator

@mvanhorn

How can I reproduce this issue? Am I missing something?

I guess pressing that FAB is switching between rich and plain edit mode?

Screen_recording_20260810_103410.webm

@mvanhorn

Copy link
Copy Markdown
Author

Yes, the FAB is the mode switch. The dialog doesn't fire on every toggle though, which is likely why your recording looks clean. The trigger is switching modes before the previous mode's sync finishes, so the plain editor and the Text direct-edit session end up with different baselines.

Repro that works reliably (from #2196, reconfirmed by @truAlexeyRu on 2026-06-30):

  1. Open an existing note (one already synced to the server).
  2. Toggle plain to rich to plain (or rich to plain to rich) quickly, at least two switches.
  3. A slow or unstable connection makes it near-deterministic: throttle the network on the emulator or use mobile data, and switch within a couple of seconds.

Without the patch you get the "document has been changed outside of the editor" dialog even though both versions are identical. With the patch both paths reconcile against the same saved baseline on load, so an unmodified switch no longer counts as an outside change; a genuine outside edit still raises the dialog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

switching between plain edit and rich edit results in a conflict

2 participants