Optimistic Create

Optimistic UIframework/ui ↗

Click Add → server appends a row and returns authoritative list HTML.

Live

interactive.OnClick(
    ui.Button(ui.ButtonConfig{Label: "Add"}),
    interactive.Post("/__site/optimistic/create").
        OnSuccess(interactive.SetSignal("opt-create-list")),
)
  • Ship the optimistic-ui cookbook
  • Document the mutation lifecycle
  • Pair ConfirmAction with delete
The full list HTML is the response body. A true temp-row pattern (row visible before the RPC resolves, then replaced by the authoritative row on 2xx) needs an island with a small bit of registered JS — see the optimistic-ui doc, Recipe 3.