Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork4.6k
fix: make deriveds on the server lazy again#15964
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
changeset-botbot commentedMay 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
🦋 Changeset detectedLatest commit:5ba3572 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 |
|
I think we need to at least change this.foo()=3; be this.foo(3); However I wonder what are the implications of doing an assignment in the constructor (that now needs to create a new derived) |
packages/svelte/tests/runtime-runes/samples/class-state-derived-private/main.svelte OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
return function (new_value) { | ||
if (arguments.length === 0) { | ||
return updated_value ?? fn(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This calls the function on every invocation now, we should wrap it withonce
above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It should be called everytime or else the value will not change on reassignment no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If you are talking aboutfn
it the stateful value it's dependent on changes it should be rerun no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We only calledfn
once previously and that was fine and declared as the behavior on the server. The bug introduced was that it was now called eagerly, not lazily
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I know but I still think this would be the better behavior (which I was also trying to fix on#14977 )...I guess in this case is still better to wrap fn in once however
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'll add a change to wrap it in once then we can think about this in#14977 separately, for now we need to fix this critical bug
ac046df
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Fixes a regression introduced in#15820: deriveds need to be lazily called on the server, too, since they can close over variables only later defined
Fixes#15960
After having opened this I realized that the new behaviorfixed#15672
, so I guess we need to adjust this PR to keep that fixed.and this PR makes sure it stays fixedBefore 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