[PR #7217] [MERGED] fix: improve the document diff function to prevent partial ordering issues #7794

Closed
opened 2026-03-23 23:21:13 +00:00 by mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/7217
Author: @LucasXu0
Created: 1/15/2025
Status: Merged
Merged: 1/16/2025
Merged by: @LucasXu0

Base: mainHead: sync_order


📝 Commits (10+)

  • e4bdea3 fix: improve the document diff function to prevent partial ordering issues
  • 1c25a92 fix: improve the document diff function to prevent partial ordering issues
  • 1faadd5 fix: nested block padding issues
  • 56555d5 fix: improve the document diff function to prevent partial ordering issues
  • 201d94c chore: update editor version
  • 70b9d79 test: add no diff test and update text diff test
  • 163f0a1 test: delete and insert text diff with different id
  • 26dbf7f test: insert single text / delete single text tests
  • fb7928f test: multiple delete and update diff
  • b383989 test: multiple insert and update diff

📊 Changes

12 files changed (+800 additions, -198 deletions)

View changed files

📝 frontend/.vscode/launch.json (+123 -123)
📝 frontend/appflowy_flutter/ios/Podfile.lock (+22 -22)
📝 frontend/appflowy_flutter/lib/plugins/document/application/document_bloc.dart (+20 -7)
📝 frontend/appflowy_flutter/lib/plugins/document/application/document_collab_adapter.dart (+19 -14)
frontend/appflowy_flutter/lib/plugins/document/application/document_diff.dart (+172 -0)
📝 frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart (+10 -3)
📝 frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart (+3 -1)
📝 frontend/appflowy_flutter/macos/Podfile.lock (+21 -21)
📝 frontend/appflowy_flutter/pubspec.lock (+2 -2)
📝 frontend/appflowy_flutter/pubspec.yaml (+1 -1)
frontend/appflowy_flutter/test/unit_test/document/document_diff/document_diff_test.dart (+403 -0)
📝 frontend/rust-lib/Cargo.lock (+4 -4)

📄 Description

Feature Preview

  • combine the insert operations if their paths are continuous.
  • update the update operations if they are ordered to match the new index.
  • combine the delete operations if their paths are continuous.
  • tests

PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AppFlowy-IO/AppFlowy/pull/7217 **Author:** [@LucasXu0](https://github.com/LucasXu0) **Created:** 1/15/2025 **Status:** ✅ Merged **Merged:** 1/16/2025 **Merged by:** [@LucasXu0](https://github.com/LucasXu0) **Base:** `main` ← **Head:** `sync_order` --- ### 📝 Commits (10+) - [`e4bdea3`](https://github.com/AppFlowy-IO/AppFlowy/commit/e4bdea313b83eb58bc2b25dc66cf73aab1a9d732) fix: improve the document diff function to prevent partial ordering issues - [`1c25a92`](https://github.com/AppFlowy-IO/AppFlowy/commit/1c25a925c5869ce4133c92fe527ba4bc720e545a) fix: improve the document diff function to prevent partial ordering issues - [`1faadd5`](https://github.com/AppFlowy-IO/AppFlowy/commit/1faadd5551494fd6dd356e21c1fdcb6b0922ee0d) fix: nested block padding issues - [`56555d5`](https://github.com/AppFlowy-IO/AppFlowy/commit/56555d5135cda4783f4359349533ff53a7490bba) fix: improve the document diff function to prevent partial ordering issues - [`201d94c`](https://github.com/AppFlowy-IO/AppFlowy/commit/201d94cc909fe53b06ade6b87e6e8ddf258b7a93) chore: update editor version - [`70b9d79`](https://github.com/AppFlowy-IO/AppFlowy/commit/70b9d79b303beb1d012e3c86bf231ae6a2f0939e) test: add no diff test and update text diff test - [`163f0a1`](https://github.com/AppFlowy-IO/AppFlowy/commit/163f0a1893e8f7bef115dd3c45931d6b85d5d445) test: delete and insert text diff with different id - [`26dbf7f`](https://github.com/AppFlowy-IO/AppFlowy/commit/26dbf7fc87e3ed16face41fb72116cfef813e558) test: insert single text / delete single text tests - [`fb7928f`](https://github.com/AppFlowy-IO/AppFlowy/commit/fb7928f1b4616f39c1bfd0263ae351b388543fff) test: multiple delete and update diff - [`b383989`](https://github.com/AppFlowy-IO/AppFlowy/commit/b3839893025c5bc84dcfbda0f294ca789aa95a58) test: multiple insert and update diff ### 📊 Changes **12 files changed** (+800 additions, -198 deletions) <details> <summary>View changed files</summary> 📝 `frontend/.vscode/launch.json` (+123 -123) 📝 `frontend/appflowy_flutter/ios/Podfile.lock` (+22 -22) 📝 `frontend/appflowy_flutter/lib/plugins/document/application/document_bloc.dart` (+20 -7) 📝 `frontend/appflowy_flutter/lib/plugins/document/application/document_collab_adapter.dart` (+19 -14) ➕ `frontend/appflowy_flutter/lib/plugins/document/application/document_diff.dart` (+172 -0) 📝 `frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart` (+10 -3) 📝 `frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart` (+3 -1) 📝 `frontend/appflowy_flutter/macos/Podfile.lock` (+21 -21) 📝 `frontend/appflowy_flutter/pubspec.lock` (+2 -2) 📝 `frontend/appflowy_flutter/pubspec.yaml` (+1 -1) ➕ `frontend/appflowy_flutter/test/unit_test/document/document_diff/document_diff_test.dart` (+403 -0) 📝 `frontend/rust-lib/Cargo.lock` (+4 -4) </details> ### 📄 Description <!--- Thank you for submitting a pull request to AppFlowy. The team will dedicate their best efforts to reviewing and approving your pull request. If you have any questions about the project or feedback for us, please join our [Discord](https://discord.gg/wdjWUXXhtw). --> <!--- If your pull request adds a new feature, please drag and drop a video into this section to showcase what you've done! If not, you may delete this section. --> ### Feature Preview - [x] combine the insert operations if their paths are continuous. - [x] update the update operations if they are ordered to match the new index. - [x] combine the delete operations if their paths are continuous. - [x] tests <!--- List at least one issue here that this PR addresses. If it fixes the issue, please use the [fixes](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests) keyword to close the issue. For example: fixes https://github.com/AppFlowy-IO/AppFlowy/pull/2106 --> --- <!--- Before you mark this PR ready for review, run through this checklist! --> #### PR Checklist - [x] My code adheres to [AppFlowy's Conventions](https://docs.appflowy.io/docs/documentation/software-contributions/conventions) - [x] I've listed at least one issue that this PR fixes in the description above. - [x] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes. - [x] All existing tests are passing. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
mirror 2026-03-23 23:21:13 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AppFlowy-IO/AppFlowy#7794
No description provided.