Skip to content

fix(web): name the client-only-allocation drift in the hydration key-… - #5245

Closed
leo7martins wants to merge 2 commits into
solidjs:mainfrom
leo7martins:fix/5226-hydration-id-drift
Closed

leo7martins wants to merge 2 commits into
solidjs:mainfrom
leo7martins:fix/5226-hydration-id-drift

Conversation

@leo7martins

Copy link
Copy Markdown

…miss warning (#5226)

Reproduce the menu-button hydration-id drift in the parity harness and at the document root: a focus primitive whose isServer early-out skips, on the server, the three id consumers it creates on the client while hydrating (the hydratable signal's onSettled effect and the two event-listener effects) shifts the client's key sequence three past the server's; every keyed claim after the gate misses, the server-rendered chain stays unclaimed behind a detached clone, and the button is dead in dev and (silently) in production. The drift tree is pinned as a known failure; the same chain with the primitive's allocations present on both builds claims and stays interactive through a real click, in the development and LOWER_SHOW (production compile) lanes. The dev key-miss warning now names this drift class beside the NoHydration guidance.

Summary

How did you test this change?

leo7martins and others added 2 commits November 27, 2026 12:20
…miss warning (solidjs#5226)

Reproduce the menu-button hydration-id drift in the parity harness and at
the document root: a focus primitive whose isServer early-out skips, on the
server, the three id consumers it creates on the client while hydrating
(the hydratable signal's onSettled effect and the two event-listener
effects) shifts the client's key sequence three past the server's; every
keyed claim after the gate misses, the server-rendered chain stays
unclaimed behind a detached clone, and the button is dead in dev and
(silently) in production. The drift tree is pinned as a known failure; the
same chain with the primitive's allocations present on both builds claims
and stays interactive through a real click, in the development and
LOWER_SHOW (production compile) lanes. The dev key-miss warning now names
this drift class beside the NoHydration guidance.
@changeset-bot

changeset-bot Bot commented Nov 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 42bf9e6

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

This PR includes changesets to release 5 packages
Name Type
@solidjs/web Patch
@solidjs/diagnostics Patch
@solidjs/signals Patch
solid-js Patch
@solidjs/universal 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

@codspeed

codspeed Bot commented Dec 2, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

2 warnings

⚠️ Upgrade your CodSpeed plugin for Node.js 24

@codspeed/* 5.4.0 is only tested on Node.js 18, 20, and 22, so your Node.js 24 measurements may be inaccurate. Upgrade your @codspeed/* packages to 6.0.0 or later.

See affected benchmarks

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 205 untouched benchmarks
⏩ 5 skipped benchmarks1


Comparing leo7martins:fix/5226-hydration-id-drift (42bf9e6) with main (510bb8d)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Copy link
Copy Markdown
Member

Thanks @leo7martins, the diagnosis here is spot on. The drift comes from the primitive returning early on isServer before it creates its effects, so the browser allocates hydration ids the server never reserved.

We'd rather not put this in the key-miss warning, since that warning fires for every key miss, including ones where the cause is a bug on our side. The advice belongs in the docs, so we've added it to the SSR-safe code guide in solidjs/solid-docs#1723, with the avoid/prefer shape. Closing this in favour of that. Thanks for the careful repro!

— Claude via Claude Code


Generated by Claude Code

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.

2 participants