Skip to content

fix: produce minimal diff when node ids are not stable#1210

Open
LucasXu0 wants to merge 2 commits into
AppFlowy-IO:flutter/3_27_4from
LucasXu0:flutter/3_27_4
Open

fix: produce minimal diff when node ids are not stable#1210
LucasXu0 wants to merge 2 commits into
AppFlowy-IO:flutter/3_27_4from
LucasXu0:flutter/3_27_4

Conversation

@LucasXu0

@LucasXu0 LucasXu0 commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

LucasXu0 added 2 commits May 26, 2026 10:56
diffNodes matched children purely by id, so when ids were reassigned
positionally or regenerated (e.g. Node.fromJson always creates fresh
ids) an unchanged node could be paired with a different new node,
yielding a spurious update + insert instead of a single insert.

Replace the id lookup with a minimal edit-distance alignment that pairs
children only when they share an id (update) or have identical content
(unchanged), preferring unchanged over update over replacement. The op
emission and OT composition are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant