weft
ir 2.6.0 · warp 1.8.0
Part three · Step 13 of 19

Instant navigation

A click that commits a route already fetched, parsed and painting nothing.

Goal

Turn the shop’s links into navigations that are already finished when they are clicked, and see that the shell never re-renders because it never changed.

A navigation between two pages under the same layout is not a new document. The shell is identical, so the only thing that has to arrive is the part that differs — and it can arrive before the click.

1 · Nothing to turn on

The client is already there, because the page adopted. A link to a route in this application is staged on intent — hover, focus, or a touch that has not lifted — and committed on click. What you write is a link:

sketch — not compiled
<a href="/item/{item.sku}">{item.name}</a>

2 · Watch a click that costs nothing

$ npx weft dev --devtools  hover /item/oat-milk   staged · 1 region, 612 B  click /item/oat-milk   committed in 4 ms · shell unchanged, 0 bytes  paint                  1 region replaced, 0 layout of the document

The shell did not move because the plan knows it did not change: both routes name the same document, so the chain above the slot is the same chain. A staged epoch that is never clicked is discarded, and a click that arrives first is awaited rather than raced.