feat(sync): replay durable projections from Rust

req: ms/001

req: ms/002

req: ms/003
This commit is contained in:
slhx agent
2026-07-14 00:17:20 +02:00
parent 2a74a28d3b
commit 3bad745da9
6 changed files with 217 additions and 178 deletions
+10 -6
View File
@@ -87,11 +87,15 @@ pub fn reorder_card(
Some(before) => ui::client_board::client_cards.move_before(card.clone(), before.0),
None => ui::client_board::client_cards.move_to_end(card.clone()),
};
(
move_effect,
ui::client_board::client_notice.text(format!("Moved {card} with {}", projected.input_kind)),
hemx_sync::SyncEffect::send_patch(patch),
)
let projection = hemx::IntoEffect::into_batch(
(
move_effect,
ui::client_board::client_notice
.text(format!("Moved {card} with {}", projected.input_kind)),
),
ui::BUILD_FINGERPRINT,
);
hemx_sync::SyncEffect::durable(patch, projection)
}
#[cfg(all(test, feature = "client"))]
@@ -115,7 +119,7 @@ mod client_tests {
.into_batch(ui::BUILD_FINGERPRINT);
assert_eq!(batch.ops.len(), 3);
assert!(
matches!(&batch.ops[2], hemx::advanced::Effect::Emit { name, payload } if name == hemx_sync::PATCH_EVENT && payload.contains("$hemx-interaction"))
matches!(&batch.ops[2], hemx::advanced::Effect::Emit { name, payload } if name == hemx_sync::PATCH_EVENT && payload.contains("$hemx-interaction") && payload.contains("\"projection\":["))
);
}
}