-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Private $derived
class fields break SSR
#15960
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
Comments
$derived
in classes breaks on SSR$derived
class fields break SSR
6 tasks
This was referenced May 20, 2025
n00ki
added a commit
to n00ki/sveltekit-omakase
that referenced
this issue
May 22, 2025
This was referenced May 22, 2025
Rich-Harris
pushed a commit
that referenced
this issue
May 22, 2025
* fix: make deriveds on the server lazy again 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 * fix: handle basic assignment of deriveds on the server * fix: use `build_assignment_value` for deriveds assignments * use once * allow writing to public deriveds on server --------- Co-authored-by: paoloricciuti <ricciutipaolo@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
On initial load/SSR, private class fields that use
$derived
break with the following:TypeError: Cannot read properties of undefined (reading '<var name>')
Introduced in
svelte@5.31.0
Reproduction
Stackblitz: https://stackblitz.com/github/AdrianGonz97/dependent-on-private-derived-repro?file=README.md
GitHub Repo: https://github.com/AdrianGonz97/dependent-on-private-derived-repro
Logs
System Info
(StackBlitz) Binaries: Node: 20.19.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.8.2 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: svelte: ^5.0.0 => 5.31.1
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: