feat(sync): replay durable projections from Rust
req: ms/001 req: ms/002 req: ms/003
This commit is contained in:
@@ -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\":["))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user