Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 347b49d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
✅ Deploy Preview for solid-primitives-v2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
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
Kobalte |
510ebcc to
347b49d
Compare
Problem
On
next,createResizeObserverandcreateWindowSizeshift the hydration keys of every sibling rendered after them, causing hydration mismatches. For example, KobalteTabs.Indicatorbreaks 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
onSettledfor window size.Fix
createResizeObserver: its client-only effect is marked{ transparent: true }, so it takes no hydration ID.createWindowSize: callsonSettledon 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 forcreateEventListener): these effects only exist on the client, so instead of faking an owner on the server they opt out of hydration ID counting withtransparent: 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.14peer range.onSettledalready reserves its ID on the server, so the hydratable helpers just call it on both sides.createEventListenercould adopttransparentin 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.