duckweb_slot

scalar · LOAD duckweb

duckweb_slot(VARCHAR, VARCHAR) -> VARCHAR

Reserves a region of the page for content that arrives later in the same response.

SELECT duckweb_chunk(duckweb_slot('chart', '<p>drawing…</p>'))
FROM duckweb_match(route, '/species/:name') WHERE method = 'GET'

Emits <div id="..." data-duckweb-slot> holding initial, which is what the reader sees until the fill arrives.

The point is ordering. Emit the placeholder early and duckweb_slot_fill late, and everything between them reaches the reader without waiting for the slow part — the page is useful while the expensive query is still running.

Ids are filtered to letters, digits, - and _. An id lands in an attribute and in a JavaScript string literal, so anything that could close either is dropped rather than escaped.