What It Teaches
Use this example when the page should paint immediately but several sections
depend on slower data sources.Suspense renders the shell with None
placeholders, then streams resolved blocks back as htmx OOB swaps inside the
same HTTP response.
It is the example to study for:
- the difference between initial-render streaming and post-load SSE
- skeleton placeholders that use
{% if value is not none %} - deferred block discovery and explicit
defer_blocks - OOB swap targets generated by
Suspense
Run It
PYTHONPATH=src python examples/standalone/suspense_dashboard/app.py
Open http://127.0.0.1:8000/.
Test It
pytest examples/standalone/suspense_dashboard/
Contract Surface
Suspense is sensitive to falsy resolved values. Empty lists,0, and empty
strings are valid resolved data, so templates should testis not noneor use
__chirp_defer_pending__ instead of a bare truthiness check. chirp check
warns about the common footgun when templates self-declare deferred keys.