Skip to content

Experimental: transitons + dev server improvements - #4276

Draft
dev-dist wants to merge 2 commits into
mainfrom
perf-dev-server-and-view-transitions
Draft

dev-dist wants to merge 2 commits into
mainfrom
perf-dev-server-and-view-transitions

Conversation

@dev-dist

@dev-dist dev-dist commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Two related changes that make navigating the docs feel instant:

  1. Fix the slow dev server -- page loads went from ~4.7s to ~160ms (Applied patch in this PR, the real fix is the barrel imports from icon)
  2. Turn on client-side navigation -- pages now swap without a full reload

1. Dev server performance

Cause: Astro's dev server walks the page's module graph on each request. For every import it calls isImportedBy, which reads Vite's importers getter. That getter rebuilds a Set of every importer on each read. @chainlink/blocks re-exports ~3,670 icons from its root barrel, and every icon imports iconVariants.ts — roughly 27M iterations per request.

Fix:

  • astro+5.18.2.patch — a 10-line change that reads the per-environment importer Sets directly instead of going through the slow getter. Applied automatically by the existing patch-package postinstall.
  • tailwind.config.js — stop scanning MDX pages and the ~3,700 icon files. Neither contributes any classes, but together they were ~80% of Tailwind's cold start.
Before After
Warm render 3.3s 0.16s
Cold first request 27s 10s
After an MDX save 4.8s 0.49s

2. Client-side navigation

The site was doing a full document load on every click creating an annoying white flash between pages, which many docs sites do not have. Makes the docs feel slow.

  • Added ClientRouter to BaseLayout.astro
  • Enabled prefetch in astro.config.ts (hover strategy, so we don't prefetch all ~160 sidebar links at once)

Follow-on fixes this required:

  • Inline head scripts now use data-astro-rerun so they re-run after each navigation
  • DOMContentLoaded listeners switched to astro:page-load, which fires on both initial load and every client-side navigation
  • Fixed a bug where the whole page went non-interactive: opening the mobile nav dialog sets pointer-events: none on body (Radix scroll lock). Navigating from a link inside the dialog unmounted it without running Radix's cleanup, leaving the lock behind. Added a guard that clears a stale lock after each navigation.

@vercel

vercel Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
documentation Ready Ready Preview Oct 5, 2026 7:54pm UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — 4b630a69 Deployed Oct 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant