Skip to content

docs(ssr): primitives that return early on isServer shift hydration ids - #1723

Open
ryansolid wants to merge 1 commit into
v2-rebuildfrom
claude/project-thread-vnjtow
Open

ryansolid wants to merge 1 commit into
v2-rebuildfrom
claude/project-thread-vnjtow

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Description(required)

A primitive that returns early on isServer before creating its effects leaves the browser ahead in the hydration id sequence. Every computation takes the next id of its owner, and the server reserves the same ids even for effects it never runs. Every element rendered after the primitive then misses its key: the browser builds a detached copy with the handlers, and the server's copy stays on the page with none, silently in production.

This was found in solidjs/solid#5226, and solidjs/solid#5245 proposed adding the advice to the dev key-miss warning. It belongs in the docs instead, so this PR:

  • adds "Primitives that return early on the server" to the SSR-safe code guide, with an avoid/prefer focus-trap example
  • points the Hydration key miss explanation at it, and adds a common problem, "A button renders but does nothing after hydration"
  • adds a recap line
  • changes the custom primitives guide, which suggested guarding body setup with isServer, to point at the new section instead

pnpm lint:tone and Prettier pass. The one tone warning is pre-existing, in a generated reference page.

Related issues & labels


Generated by Claude Code

A primitive that skips its effects on the server leaves the browser
ahead in the hydration id sequence, so every element after it misses
its key and stays dead after hydration (solidjs/solid#5226, #5245).
Add a section to the SSR-safe code guide with the avoid/prefer shape,
point the key-miss warning and a new common problem at it, and stop
suggesting an isServer guard in the custom primitives troubleshooting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC
@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@netlify

netlify Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for solid-docs-v2 ready!

Name Link
🔨 Latest commit e7069a3
🔍 Latest deploy log https://app.netlify.com/projects/solid-docs-v2/deploys/6b0fd817084057e71a0a561c
😎 Deploy Preview https://deploy-preview-1723--solid-docs-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

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