Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid writing to state in media-query getter #122

Merged
merged 2 commits into from
Jul 27, 2024

Conversation

paoloricciuti
Copy link
Contributor

@paoloricciuti paoloricciuti commented Jul 24, 2024

This fixes a bug someone opened in the svelte repo but it was actually our (namely my lol) bad.

EDIT: oh they also reported here... Closes #121

sveltejs/svelte#12571 (comment)

We should avoid writing to state in the getter but we can just leave the state undefined and return the actual value from mediaQuery list (it will still be reactive from the moment we register the listener since we are still accessing the signal to check if it's undefined).

EDIT: i've also changed effectRegistered to a number to handle the case where multiple components that access the same instance of the class mount in the same tick.

Copy link

changeset-bot bot commented Jul 24, 2024

🦋 Changeset detected

Latest commit: 6382da6

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

This PR includes changesets to release 1 package
Name Type
runed 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

Copy link
Contributor

github-actions bot commented Jul 24, 2024

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
runed ✅ Ready (View Log) Visit Preview 6382da6

Copy link
Member

@huntabyte huntabyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks dude!

@huntabyte huntabyte merged commit b1b4770 into svecosystem:main Jul 27, 2024
4 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
2 participants