-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
related #15280
When writing a Svelte component like the following in runes mode...
<script>
import { writable } from 'svelte/store';
let obj = writable({ name: 'foo'});
const clone1 = structuredClone($obj); // OK
$obj = { name: 'bar' };
const clone2 = structuredClone($obj); // error
</script>{ name: 'bar' } becomes proxied in the JS output as shown below:
let obj = writable({ name: 'foo' });
const clone1 = structuredClone($obj());
$.store_set(obj, $.proxy({ name: 'bar' })); // here
const clone2 = structuredClone($obj());In the following cases, this issue does not occur:
- When assigning a primitive value instead of an object
- When using the writable store’s
setmethod instead of the=operator - In non-runes mode
Reproduction
https://svelte.dev/playground/77f58c2f61394b4ca4efc5b62ea63d29?version=5.20.0
Logs
System Info
System:
OS: macOS 14.6.1
CPU: (12) arm64 Apple M2 Pro
Memory: 1.45 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm
pnpm: 9.7.0 - /opt/homebrew/bin/pnpm
Browsers:
Chrome: 133.0.6943.54
Safari: 17.6
Safari Technology Preview: 18.2Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels