Skip to content
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

Pass state problem in Svelte 5 #15194

Closed
Enes5519 opened this issue Feb 3, 2025 · 0 comments · Fixed by #15206
Closed

Pass state problem in Svelte 5 #15194

Enes5519 opened this issue Feb 3, 2025 · 0 comments · Fixed by #15206
Assignees

Comments

@Enes5519
Copy link

Enes5519 commented Feb 3, 2025

Describe the bug

I have doubts about whether the states are transferred correctly when using a library that I have in Svelte 4 in Svelte 5. While it works without any problems in Svelte 4, it does not work the same way in Svelte 5.

I prepared an app that changes the radio value every second. If you look at the links in reproduction, you can understand the problem exactly.

Reproduction

Svelte 4: https://stackblitz.com/edit/vitejs-vite-bqjij8vn?file=src%2FApp.svelte
Svelte 5: https://svelte.dev/playground/00f889e5d7f84dbbaba90c6014fb5606?version=5.19.6

Logs

System Info

System:
    OS: macOS 15.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 97.73 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 9.4.0 - /usr/local/bin/pnpm
    bun: 1.1.17 - ~/.bun/bin/bun
    Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 132.0.6834.160
    Safari: 18.2
  npmPackages:
    @sveltejs/vite-plugin-svelte: ^4.0.0 => 4.0.4 
    svelte: ^5.0.0 => 5.19.1 
    vite: ^5.4.10 => 5.4.10

Severity

annoyance

@dummdidumm dummdidumm self-assigned this Feb 3, 2025
dummdidumm added a commit that referenced this issue Feb 4, 2025
Avoid going through the `element.value = element.__value = newValue` condition because `__value` is actually how Lit stores the current value on the element, and messing with that would break things: Lit would think the value hasn't changed (because `__value` is already set to the new value by us) and doesn't fire an update.

fixes #15194
dummdidumm added a commit that referenced this issue Feb 4, 2025
Avoid going through the `element.value = element.__value = newValue` condition because `__value` is actually how Lit stores the current value on the element, and messing with that would break things: Lit would think the value hasn't changed (because `__value` is already set to the new value by us) and doesn't fire an update.

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

Successfully merging a pull request may close this issue.

2 participants