Skip to content

fix(resize-observer): keep hydration ids aligned for client-only effects - #1069

Merged
davedbase merged 1 commit into
solidjs-community:nextfrom
devagrawal09:fix/resize-observer-server-owner
Oct 13, 2026
Merged

davedbase merged 1 commit into
solidjs-community:nextfrom
devagrawal09:fix/resize-observer-server-owner

Conversation

@devagrawal09

@devagrawal09 devagrawal09 commented Oct 13, 2026 •

Copy link
Copy Markdown

Problem

On next, createResizeObserver and createWindowSize shift the hydration keys of every sibling rendered after them, causing hydration mismatches. For example, Kobalte Tabs.Indicator breaks hydration on direct page loads.

Cause

Solid 2 assigns hydration keys by counting owners. On the server these primitives create no owner, but on the client they do: an observer effect, and onSettled for window size.

Fix

  • createResizeObserver: its client-only effect is marked { transparent: true }, so it takes no hydration ID.
  • createWindowSize: calls onSettled on both sides. The server version reserves the matching ID and never runs the callback.

No extra server owners.

Why not createOwner() on the server (as #1048 did for createEventListener): these effects only exist on the client, so instead of faking an owner on the server they opt out of hydration ID counting with transparent: true. Solid documents this option as being 'for client-only effects the server never created', and it's available in the ^2.0.0-rc.14 peer range. onSettled already reserves its ID on the server, so the hydratable helpers just call it on both sides. createEventListener could adopt transparent in a follow-up for consistency.

Test

Added one hydration regression with a following sibling to the existing hydration.test.tsx. It fails before the fix.

@changeset-bot

changeset-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 347b49d

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

This PR includes changesets to release 1 package
Name Type
@solid-primitives/resize-observer 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

@netlify

netlify Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for solid-primitives-v2 ready!

Name Link
🔨 Latest commit 347b49d
🔍 Latest deploy log https://app.netlify.com/projects/solid-primitives-v2/deploys/6acdaeb113503ba7b2bf20c4
😎 Deploy Preview https://deploy-preview-1069--solid-primitives-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.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: da755e96-4004-4855-9e4a-474a4b23963d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devagrawal09

Copy link
Copy Markdown
Author

Related: #1070 fixes the same owner-count issue in event-listener, interaction, keyboard, scroll, media, utils and static-store. #1071 fixes storage sync cleanup.

Release request: could you publish new next versions once these land? Two fixes are already on next but unpublished, and Solid 2 consumers need them:

Kobalte 2.0.0-alpha.2 pins event-listener and resize-observer exactly, so its Tabs break hydration until these ship. SolidBase is currently working around it for its Solid 2 migration (kobaltedev/solidbase#174).

@devagrawal09
devagrawal09 force-pushed the fix/resize-observer-server-owner branch from 510ebcc to 347b49d Compare October 13, 2026 04:08
@devagrawal09 devagrawal09 changed the title fix(resize-observer): reserve server hydration owners fix(resize-observer): keep hydration ids aligned for client-only effects Oct 13, 2026
@davedbase
davedbase merged commit b0b5aa0 into solidjs-community:next Oct 13, 2026
8 of 9 checks passed
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