Skip to content

Svelte 5: regression, read-only props make optimistic updates impossible #10084

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

Closed
Thiagolino8 opened this issue Jan 4, 2024 · 1 comment
Closed

Comments

@Thiagolino8
Copy link

Thiagolino8 commented Jan 4, 2024

Describe the bug

Mutating the prop data has always been the way to make optimistic updates with sveltekit, being the way recommended by Rich himself
But because props have become read-only this is no longer possible whether using the v3/4 or V5 syntax, which will certainly break many existing apps

Reproduction

V4 compiler
V5 compiler

Logs

Error: Non-bound props cannot be mutated — to make the `todos` settable, ensure the object it is used within is bound as a prop `bind:<prop>={...}`. Fallback values can never be mutated.

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.10.5 - /usr/local/bin/pnpm
  npmPackages:
    svelte: next => 5.0.0-next.28

Severity

blocking an upgrade

@elliott-with-the-longest-name-on-github
Copy link
Contributor

This is probably more of a Kit issue than a Svelte 5 issue; I bet Kit could just add bind:data= instead of plain data= to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants