Wiki本文の意図しない複製を防ぐ - #12
Open
NishikawaKoharu wants to merge 1 commit into
Open
Conversation
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.
Purpose
Fix unintended duplication of Wiki page content in the Milkdown collaborative editor.
Stale local IndexedDB operations could be merged with the live Yjs document after y-websocket sync—for example, when a tab is closed without saving, the collaborative server state later becomes empty, and the user re-enters Edit while stale IndexedDB data still exists. This caused the same content to appear multiple times in the editor.
This PR connects IndexedDB persistence only after WebSocket sync and clears stale local IndexedDB data when the remote collaborative document already has content, preventing duplicate merges.
Changes
attachIndexeddbForSession: attach IndexedDB only after y-websocket sync; clear stale local IndexedDB ops when remote content already exists.isCollabXmlFragmentEmpty,waitForIndexeddbSynced.connectCollab: determine whether the remote document has content before attaching IndexedDB, instead of connecting IndexedDB immediately on editor creation.armEditorTypingAssist/disarmEditorTypingAssist): restore editor focus when the user starts typing after entering edit mode.Changed files:
addons/wiki/static/wikiPageMilkdown.jsonly.QA Notes
Suggested QA scenarios
Single browser — tab close without save
Save and reload
Typing after entering Edit
Stale IndexedDB + empty y-websocket (main repro)
Documentation
Side Effects
wiki-edit-page.jsbundle for changes to take effect in the main application.Ticket
https://redmine.devops.rcos.nii.ac.jp/issues/61562