Skip to content

jakst/tss-css-reloads

Repository files navigation

TanStack Solid Router — CSS <link> remount repro

This repo reproduces a bug where client-side navigation between two routes with different match-chain preload counts causes every route-managed <link rel="stylesheet"> to be removed from and re-added to <head> — producing a Flash of Unstyled Content in production.

The bug only reproduces in a production build — not in vite dev.

Observing the bug

  1. Install dependencies:
    pnpm install
  2. Build the app for production (it doesn't reproduce with the dev server):
    pnpm build
  3. Start the preview server:
    pnpm preview
  4. Open the app (probably on http://localhost:3000/) in a browser.
  5. Open DevTools and the Network Inspector, and then check Disable cache and select the CSS filter
  6. Optional: Refresh with devtools open, and select the CSS request and throttle it to 3G speeds for a more dramatic effect (right click => Throttle requests => Throttle request URL)
  7. Click around between the links Home/A/B/C in the navigation.
  8. Notice that there's a FOUC between some navigations. If you look at the network inspector you should see that the css file reloads on those navigations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors