From a30499ffedb76dc08ba7e9c9b2ed4eb3f921a5df Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 20 Oct 2026 00:51:39 +0200 Subject: add epoch switch --- src/sync.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/sync.rs') diff --git a/src/sync.rs b/src/sync.rs index d9f629e..07ed1a0 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -458,6 +458,12 @@ pub(crate) async fn run_change_publisher(state: AppState) { return (heads, Vec::new(), Vec::new()); } + // After an epoch switch the previous heads belong to the old document: + // report the root as changed, which every stream is related to. + if !before.iter().all(|h| doc.get_change_by_hash(h).is_some()) { + return (heads, vec![Vec::new()], Vec::new()); + } + let mut paths = Vec::new(); let mut conflicts = Vec::new(); for patch in doc.diff(&before, &heads) { -- cgit v1.3.1