UndoManager: batch imports clear undo history
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 62/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, rust
- 領域
- data
調査の方向性
Start in crates/loro-internal/src/loro.rs at import_batch (~L4099) and follow BatchImportGuard::finish, which reattaches via _checkout_to_latest_without_commit and emits EventTriggerKind::Checkout; UndoManager in crates/loro-internal/src/undo.rs clears both stacks on that event. The unused _checkout_to_latest_without_commit_as_import (~L2900) emits Import instead, so compare the two paths before wiring one in. Turn the JS repro into a failing test (canUndo() stays true after importBatch, undo() yields "RS"), then confirm separate import() calls still behave the same.
索引モデルが issue の本文から書いたものです。
説明
versions: [email protected]. broken on 1.16.2, 1.10.0 and 1.5.0.
- Local inserts
"L"and commits.canUndo()istrue - Remote makes two commits,
"R"and"S", exported as two update blobs - Local imports them with
importBatch([first, second]) - The text is
"LRS", correct, butcanUndo()is nowfalseandundo()does nothing
repro:
const { LoroDoc, UndoManager } = require("loro-crdt");
const local = new LoroDoc();
local.setPeerId("1");
const remote = new LoroDoc();
remote.setPeerId("2");
const undo = new UndoManager(local, { mergeInterval: 0 });
local.getText("t").insert(0, "L");
local.commit();
console.log(undo.canUndo()); // true
const blobs = [];
for (const c of ["R", "S"]) {
const vv = remote.oplogVersion();
remote.getText("t").insert(remote.getText("t").length, c);
remote.commit();
blobs.push(remote.export({ mode: "update", from: vv }));
}
local.importBatch(blobs);
console.log(local.getText("t").toString()); // "LRS"
console.log(undo.canUndo()); // false
console.log(undo.undo()); // false
expected: canUndo() is still true and undo removes "L", giving "RS", like two separate import() calls
actual: the undo stack is wiped
impl: for 2+ blobs, import_batch force-detaches, imports, then reattaches in BatchImportGuard::finish via _checkout_to_latest_without_commit, which emits EventTriggerKind::Checkout. UndoManager clears both stacks on Checkout. There's already a _checkout_to_latest_without_commit_as_import that emits Import, but nothing calls it
- 主要言語
- Rust
- スター
- 6.3k
- フォーク
- 205
- 平均マージ
- 3日 18時間
- マージ済み PR(30日)
- 45
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
loro-dev/loro のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
メンテナーはふだん 1 日以内に返信
-
Shallow snapshot root retreats far below the requested frontier when two peers take turns (since 1.16.2)対応中かも @avergin が今日担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
Selected chart highlights only its values, not its series names and category labels対応中かも @Higgs32584 が今日担当しました。 オープンbug priority: low ui
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
storytold/gridcraft#4390 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
bug bugfix priority: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
quarto-dev/q2#1219 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100