Skip to content

fix(router): serialize less router state - #9090

Merged
Varixo merged 4 commits into
mainfrom
claude/router-lean-state
Oct 6, 2026
Merged

Varixo merged 4 commits into
mainfrom
claude/router-lean-state

Conversation

@maiieul

@maiieul maiieul commented Sep 30, 2026

Copy link
Copy Markdown
Member

What is it?

  • Feature / enhancement

Description

Every page serializes less router state: the document head gets one subscription instead of one per field, and server-only values, defaults and an unused loader marker stay out of the state. On the starter's home page, router state drops from 2.5 KB to 1.7 KB.

@maiieul
maiieul requested review from a team as code owners September 30, 2026 14:30
@changeset-bot

changeset-bot Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 49f841a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@qwik.dev/router Patch
eslint-plugin-qwik Patch
@qwik.dev/mcp Patch
create-qwik Patch
@qwik.dev/devtools Patch
@qwik.dev/react Patch
@qwik.dev/utils Patch
@qwik.dev/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@maiieul
maiieul added this pull request to stack #9092 September 30, 2026 14:30
@maiieul maiieul self-assigned this Sep 30, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@qwik.dev/core

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@9090

@qwik.dev/router

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@9090

@qwik.dev/utils

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/utils@9090

eslint-plugin-qwik

npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@9090

create-qwik

npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@9090

@qwik.dev/optimizer

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/optimizer@9090

@qwik.dev/devtools

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/devtools@9090

@qwik.dev/mcp

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/mcp@9090

commit: 49f841a

@maiieul
maiieul force-pushed the claude/router-lean-state branch from 731828c to f60f23b Compare September 30, 2026 15:26
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview 49f841a

The head store was deep and DocumentHeadTags spread it, so every field,
head array and meta entry added a subscription and back-ref roots to the
state. The router replaces head fields wholesale, so a shallow store
and one all-props subscription cover every update.
- actionDataSignal kept the whole response envelope (status message,
  form data) although the head only reads the action result.
- routeInternal's initial value only serves SSR; the client rebuilds it
  from routeLocation on its first navigation.
- routeLoaderCtx was a store that nothing tracks.
- A 200 OK httpStatus is stored as undefined and useHttpStatus()
  returns the default.
- usePreventNavigate$ imports registerPreventNav instead of reading a
  QRL from a context.
Since 3b7b79e the loader request computes its own fetch path, so the
__qwik_route_loader_value__ entry is written but never read. It added
~46 bytes per loader to every page.
@maiieul
maiieul force-pushed the claude/router-lean-state branch from f60f23b to 49f841a Compare October 6, 2026 10:31

@Varixo Varixo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Varixo
Varixo merged commit 3ea02c2 into main Oct 6, 2026
@Varixo
Varixo deleted the claude/router-lean-state branch October 6, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants