-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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: don't depend on deriveds created inside the current reaction #15564
Conversation
🦋 Changeset detectedLatest commit: f430de4 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 |
|
If we don't want effects to rerun when state they create changes, then by extension we also don't want that for deriveds, regardless what sources they have. I also don't know in what situation you would create a derived inside an effect and want it to re-run when said derived changes. |
I think this is a sensible change, but it's also maybe a breaking change. I guess we can release it and address if that is the case. |
Unfortunately this breaks the svelte integration of SignalDB 😕 Some more information about the integration: https://signaldb.js.org/guides/svelte/ cc @ykrods |
Follow-up to #15553 which fixes this case.
Unfortunately it changes the behaviour of effects in a way that could be considered breaking — in a case like this, where a derived that's local to an effect depends on state outside the effect...
...today the effect will re-run when
count
changes, but in this PR it won't. I'm not sure there's a way to have that behaviour and have effects not depend on deriveds that depend entirely on local state. I think this is the right trade-off, but I'd love to hear from other maintainers.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint