diff --git a/crates/loro-internal/src/state/movable_list_state.rs b/crates/loro-internal/src/state/movable_list_state.rs index 27bb11b0..379dcad8 100644 --- a/crates/loro-internal/src/state/movable_list_state.rs +++ b/crates/loro-internal/src/state/movable_list_state.rs @@ -960,6 +960,8 @@ impl ContainerState for MovableListState { self.list().is_empty() && self.elements().is_empty() } + // How we apply the diff is coupled with the [DiffMode] we used to calculate the diff. + // So be careful when you modify this function. #[instrument(skip_all)] fn apply_diff_and_convert( &mut self, @@ -1237,6 +1239,8 @@ impl ContainerState for MovableListState { Diff::List(event) } + // How we apply the diff is coupled with the [DiffMode] we used to calculate the diff. + // So be careful when you modify this function. fn apply_diff(&mut self, diff: InternalDiff, ctx: DiffApplyContext) { let _ = self.apply_diff_and_convert(diff, ctx); } diff --git a/crates/loro-internal/src/state/tree_state.rs b/crates/loro-internal/src/state/tree_state.rs index a7edc34f..38b12327 100644 --- a/crates/loro-internal/src/state/tree_state.rs +++ b/crates/loro-internal/src/state/tree_state.rs @@ -852,6 +852,8 @@ impl ContainerState for TreeState { self.nodes().is_empty() } + // How we apply the diff is coupled with the [DiffMode] we used to calculate the diff. + // So be careful when you modify this function. fn apply_diff_and_convert( &mut self, diff: crate::event::InternalDiff, @@ -972,6 +974,8 @@ impl ContainerState for TreeState { Diff::Tree(TreeDiff { diff: ans }) } + // How we apply the diff is coupled with the [DiffMode] we used to calculate the diff. + // So be careful when you modify this function. fn apply_diff(&mut self, diff: InternalDiff, ctx: DiffApplyContext) { if let InternalDiff::Tree(tree) = &diff { let need_check = !matches!(ctx.mode, DiffMode::Checkout | DiffMode::Linear);