Add live server updates
Introduce Datastar and SSE only when the task requires server-authoritative patches. The Advanced index documents transport patterns, server routes, and attention-respecting defaults.
Progressive ladder
1. Server-authoritative HTML
Start with complete server-rendered regions and stable element ids. Persistent state, permissions, and validation belong to the server.
2. Datastar transport
Local signals are useful for transient presentation; durable updates return HTML or SSE patches from application routes.
3. SSE status streams
Long-lived streams patch stable status elements as a job, order, or upload advances. Prefer event-driven pushes over surprise periodic polling.
4. Attention-respecting updates
Use aria-live sparingly for genuinely changing data. Do not surprise users with unprompted movement, auto-advancing carousels, or demo intervals treated as product defaults.
Attention-respecting defaults
- Prefer explicit user-initiated refresh or genuinely event-driven server pushes over unprompted periodic SSE.
- Mark live regions with
aria-liveonly when content changes after load and the update is meaningful to the task. - Documentation demo intervals are not product defaults—production applications should not surprise users with movement on a fixed cadence.
- When enhancement fails, complete server-rendered HTML and ordinary navigation remain the fallback.
Open the Advanced Datastar + SSE index for runnable examples, server route patterns, and recipe coverage.
Common live-update recipes
Active search
Debounced signal request; server replaces a live results region.
Inline validation
Server validates a field and streams field/error fragments; native validation stays first.
Progress and realtime status
Long-lived SSE patches stable status elements as a job advances.
Filter, sort, and data views
Signals describe the requested view; the server owns filtering, pagination, and permissions.