feat(build): add lower-aware put helper
Generate ui::put(slot, view) for lower-aware slot HTML updates and move examples/docs/contracts to that ergonomic path instead of hand-composing slot.html(render(...)). req: dx/006 req: component/003 req: runtime/001 req: examples/003
This commit is contained in:
@@ -138,13 +138,13 @@ async fn interact(
|
||||
// req: push/001 req: push/003 req: examples/001
|
||||
async fn events(Query(params): Query<BTreeMap<String, String>>) -> impl IntoResponse {
|
||||
if params.contains_key("once") {
|
||||
let effect = slots::presence.html(ui::render(&Presence { count: 1 }));
|
||||
let effect = ui::put(slots::presence, &Presence { count: 1 });
|
||||
return sse(stream::iter([Ok::<_, Infallible>(effect.into_batch(ui::BUILD_FINGERPRINT))]).boxed());
|
||||
}
|
||||
|
||||
let batches = stream::unfold(1_u64, |count| async move {
|
||||
tokio::time::sleep(Duration::from_secs(4)).await;
|
||||
let effect = slots::presence.html(ui::render(&Presence { count }));
|
||||
let effect = ui::put(slots::presence, &Presence { count });
|
||||
Some((Ok::<_, Infallible>(effect.into_batch(ui::BUILD_FINGERPRINT)), count + 1))
|
||||
})
|
||||
.boxed();
|
||||
@@ -206,7 +206,7 @@ fn registry(state: Arc<AppState>) -> impl DispatchRegistry {
|
||||
|
||||
fn board_effects(board: &BoardState, notice: &'static str) -> impl IntoEffect {
|
||||
(
|
||||
slots::board.html(ui::render(&board_view(board))),
|
||||
ui::put(slots::board, &board_view(board)),
|
||||
slots::notice.text(notice),
|
||||
forms::create_card.clear("title"),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user