weft
ir 2.6.0 · warp 1.8.0
Part two · Step 6 of 19

A slow region, and the first byte

Add something slow and watch the shell stop waiting for it.

Goal

Take the feed out of the critical path without moving it out of the document, and read the two numbers that prove it: time to first byte, and when the fast half became visible.

One region on the page is slow — a recommendation query, say. Declare that it streams, and the document stops being downstream of it.

1 · Declare the hole

app/routes/index.data.ts2 lines changed
  feed: { fragment: 'feed' },+ feed: { fragment: 'feed', stream: true,+         placeholder: 'feed/skeleton' },

The plan’s delivery order was in-order and is now out-of-order, because a slot asked to stream. That is derived, not declared: a page whose regions are uniformly fast never puts the fill script on the wire at all.

2 · Read what it cost

43.5 msTTFB, unchanged — the shell never read the feed
23 msfast region visible, from 105 ms
+329 Binline script, the whole price of out-of-order

3 · Ask the framework why

$ weft why /  shell    app/layout.tsx → routes/index.tsx  wave 1   header (buffered) · feed (stream)  wave 2   prices needs feed  keys     header: static · feed: shared route:page · prices: shared

What a placeholder is for

It is what arrives if the region degrades — over budget, or a loader that threw. Honest, cheap and visibly incomplete, which is the only useful behaviour: a region that failed and rendered something plausible is worse than one that failed and said so.