Skip to content

[stable35] fix(sync): do not push or save the generated initial state on open - #9629

Merged
mejo- merged 2 commits into
stable35from
backport/9589/stable35
Nov 17, 2026
Merged

mejo- merged 2 commits into
stable35from
backport/9589/stable35

Conversation

@backportbot

@backportbot backportbot Bot commented Nov 17, 2026

Copy link
Copy Markdown

Backport of PR #9589

Opening a file without a stored Yjs state applied the state generated
from the markdown as a local change. It was pushed like an edit, which
marked the document dirty, so closing the viewer or leaving the page
saved the re-serialized markdown even though nothing was edited. This
dropped trailing newlines and normalized the syntax of untouched files.

Apply the initial state with the sync provider as origin. Every client
generates the same state from the file content, and the provider sends
it along with the first local change, as it sends everything the server
does not have yet.

Fixes: #9077

Signed-off-by: Jonas <jonas@freesources.org>
Assisted-by: ClaudeCode:claude-opus-5-5
Only versions that were pushed but not saved yet marked the document as
dirty. Changes made while offline were therefore not marked dirty: they
were not kept in IndexedDB for recovery, and no conflict resolution was
offered when the file changed meanwhile.

Track whether the outbox holds a local update that was not pushed yet
and include it in the dirty state. Push pending changes before saving,
so the save includes them, and autosave versions that were pushed by a
retry without an editor update.

Signed-off-by: Jonas <jonas@freesources.org>
Assisted-by: ClaudeCode:claude-opus-5-5
@backportbot backportbot Bot added bug Something isn't working 3. to review AI assisted This PR contains AI-assisted commits labels Nov 17, 2026
@backportbot backportbot Bot added this to the Nextcloud 35.0.4 milestone Nov 17, 2026
@mejo-
mejo- enabled auto-merge November 17, 2026 10:38
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/composables/useSaveService.ts 90.90% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@mejo-
mejo- merged commit 0f31935 into stable35 Nov 17, 2026
67 of 69 checks passed
@mejo-
mejo- deleted the backport/9589/stable35 branch November 17, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review AI assisted This PR contains AI-assisted commits bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant