Slots
Content that is slow to produce goes in a slot: the placeholder is emitted early, everything after it reaches the reader immediately, and the fill arrives at the end of the response.
UNION ALL SELECT duckweb_chunk(duckweb_slot('s-chart', 'drawing…'))
FROM duckweb_match(route, '/r/:region')
UNION ALL SELECT duckweb_chunk('<table>…the rest of the page…</table>')
FROM duckweb_match(route, '/r/:region')
UNION ALL SELECT duckweb_chunk(duckweb_slot_fill('s-chart', c.svg))
FROM duckweb_match(route, '/r/:region'), (SELECT svg_line_chart(…) AS svg …) cThe fill carries a self-contained script, so a browser parsing the response directly runs it with no client library present, and the client runs it the same way. The script is idempotent, which matters: the client re-parses the response as it grows, so it runs more than once.