Skip to content

fix(media): register createBreakpoints listeners outside hydration onSettled - #1079

Merged
davedbase merged 1 commit into
solidjs-community:nextfrom
devagrawal09:fix/breakpoints-watchchange
Oct 21, 2026
Merged

davedbase merged 1 commit into
solidjs-community:nextfrom
devagrawal09:fix/breakpoints-watchchange

Conversation

@devagrawal09

Copy link
Copy Markdown

Problem

With watchChange enabled (the default), createBreakpoints registers its change listeners with makeEventListener inside the update callback passed to createHydratableStaticStore. During hydration that callback runs in onSettled, where Solid 2 forbids registering cleanup. Hydrating a component that uses createBreakpoints throws [CLEANUP_IN_FORBIDDEN_SCOPE] Cannot use onCleanup inside createTrackedEffect or onSettled.

Fix

Create the MediaQueryLists up front (client only) and register the listeners in the owner scope, the same way createMediaQuery already does. The update callback now only reads .matches. makeEventListener creates no owners, so server and client owner trees stay symmetric for hydration.

Test

Extended packages/media/test/index.test.ts with a hydration round-trip that uses createBreakpoints with the default watchChange. Before the fix it fails with CLEANUP_IN_FORBIDDEN_SCOPE; after the fix the client tests (18/18) and SSR tests (6/6) pass.

— Claude (Opus 5.5), posting on behalf of @devagrawal09

@netlify

netlify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for solid-primitives-v2 ready!

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

@changeset-bot

changeset-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 92fd772

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/media 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

@coderabbitai

coderabbitai Bot commented Oct 21, 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: a864d5b2-dea1-4c71-8eed-4323e58302d2

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.

@davedbase
davedbase merged commit 2b7d3b3 into solidjs-community:next Oct 21, 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