Incremental segment prefetching

세그먼트별 점진 사전 가져오기

Next.js 16 reuses shared layouts and prefetches only route segments missing from the cache.

···
html
<section class="stage"><div class="heading">INCREMENTAL PREFETCH <span class="hint">reuse shared layout</span></div><div class="segments"><div class="tile layout">/shop layout <small>cached</small></div><div class="paths"><div class="tile route">/item/A <small>loaded</small></div><div class="tile route new">/item/B <small>fetch</small></div></div></div><div class="caption">Prefetch only the missing segment</div></section>
css
.stage{width:min(94vw,780px);height:min(88vh,322px);padding:clamp(12px,3vmin,20px);border:1px solid var(--line);border-radius:16px;background:var(--surface);box-shadow:0 12px 36px #0001;display:flex;flex-direction:column;gap:clamp(7px,2vmin,14px);font:500 clamp(12px,3.5vmin,17px)/1.3 var(--font-sans,system-ui,sans-serif);overflow:hidden}.heading{display:flex;justify-content:space-between;align-items:center;gap:8px;font-weight:750;color:var(--accent)}.hint{color:var(--muted);font-size:clamp(12px,3.2vmin,14px);font-weight:500}.caption{margin-top:auto;color:var(--muted);font-size:clamp(12px,3.2vmin,14px)}.row{display:flex;gap:clamp(5px,1.5vmin,12px);align-items:center}.tile{padding:clamp(6px,1.8vmin,13px);border:1px solid var(--line);border-radius:9px;background:var(--bg);text-align:center;min-width:0}.arrow{color:var(--accent);font-weight:800}.stage [data-on]{transition:background .3s,border-color .3s,opacity .3s,transform .3s}.stage .on{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,var(--surface));color:var(--accent)}.segments{flex:1;display:flex;align-items:center;justify-content:center;gap:clamp(7px,2vmin,20px)}.layout{width:38%;max-width:190px;border-color:var(--accent)!important;background:color-mix(in srgb,var(--accent) 13%,var(--surface))!important}.paths{display:flex;flex-direction:column;gap:8px;width:40%;max-width:190px}.route{border-color:var(--accent-2)!important}.route.new{opacity:.3;transform:translateX(-10px);transition:opacity .3s,transform .3s}.tile small{display:block;color:var(--muted);font:600 .7em ui-monospace,monospace;margin-top:4px}.stage[data-step="1"] .route.new,.stage[data-step="2"] .route.new{opacity:1;transform:none}.stage[data-step="2"] .route:first-child{opacity:.4}.stage small,.stage button,.stage .cards b,.stage .phase b,.stage .pair b,.stage .tree-mini b{font-size:clamp(12px,3.2vmin,14px)!important}
js
const stage=document.querySelector(".stage");let step=0;function tick(){stage.dataset.step=String(step);step=(step+1)%3}tick();let timer=setInterval(tick,980);stage.addEventListener("pointerdown",()=>{clearInterval(timer);tick()})

Next.js 16 avoids downloading a shared layout separately for multiple links. Its prefetcher skips segments already in cache and requests only missing pieces.

Total bytes may fall even if the number of individual requests rises. The demo keeps one shared layout and adds only a new detail segment.

When to use

Useful when designing nested Next.js 16 routes or inspecting navigation network behavior.

Open as page ↗