Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
Rich-Harris merged 6 commits intomainfromlazy-derived-server
May 22, 2025

Conversation

dummdidumm
Copy link
Member

@dummdidummdummdidumm commentedMay 20, 2025
edited
Loading

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 fixed

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC:https://github.com/sveltejs/rfcs
  • Prefix your PR title withfeat:,fix:,chore:, ordocs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code withinpackages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests withpnpm test and lint the project withpnpm lint

echocrow and pitzzahh reacted with hooray emojihuntabyte, Wombosvideo, bigmac44, dcheglakov, mattlehrer, echocrow, and pitzzahh reacted with heart emojiieedan reacted with eyes emoji
Fixes a regression introduced in#15820: deriveds need to be lazily called on the server, too, since they can close over variables only later definedFixes#15960
@changeset-botchangeset-bot
Copy link

changeset-botbot commentedMay 20, 2025
edited
Loading

🦋 Changeset detected

Latest commit:5ba3572

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

This PR includes changesets to release 1 package
NameType
sveltePatch

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

@svelte-docs-bot
Copy link

@github-actionsGitHub Actions
Copy link
Contributor

Playground

pnpm add https://pkg.pr.new/svelte@15964

@paoloricciuti
Copy link
Member

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)


return function (new_value) {
if (arguments.length === 0) {
return updated_value ?? fn();
Copy link
MemberAuthor

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

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?

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?

Copy link
MemberAuthor

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

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

Copy link
MemberAuthor

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

@Rich-HarrisRich-Harris merged commitac046df intomainMay 22, 2025
13 checks passed
@Rich-HarrisRich-Harris deleted the lazy-derived-server branchMay 22, 2025 21:07
@github-actionsgithub-actionsbot mentioned this pull requestMay 22, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@paoloricciutipaoloricciutipaoloricciuti left review comments

@elliott-with-the-longest-name-on-githubelliott-with-the-longest-name-on-githubelliott-with-the-longest-name-on-github left review comments

@Rich-HarrisRich-HarrisRich-Harris approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Private$derived class fields break SSR [SERVER] writable $derived in class results invalid setter expression
4 participants
@dummdidumm@paoloricciuti@Rich-Harris@elliott-with-the-longest-name-on-github

[8]ページ先頭

©2009-2025 Movatter.jp