Closed
Description
Describe the bug
The $state.is
rune will always return false
if run on the server even when $state and object are the same.
e.g.
const obj = { "hi": 1 };
const a = $state(obj)
// this is true on the server but false on the client which seems correct
console.log(a === obj)
// this is false on the server but true on the client which seems wrong
console.log($state.is(a, obj))
I would expect $state.is
to return true
on the server if the $state and object are the same.
Reproduction
See the logs in the server console:
a === obj: true
$state.is(a, obj): false
a === b: true
$state.is(a, b): false
In the browser
a === obj: false
$state.is(a, obj): true
a === b: true
$state.is(a, b): true
Logs
No response
System Info
System:
OS: macOS 14.4.1
CPU: (10) arm64 Apple M1 Max
Memory: 2.67 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.0.0 - ~/.nvm/versions/node/v22.0.0/bin/node
npm: 10.5.1 - ~/.nvm/versions/node/v22.0.0/bin/npm
pnpm: 9.1.1 - ~/.nvm/versions/node/v22.0.0/bin/pnpm
bun: 1.1.9 - /opt/homebrew/bin/bun
Watchman: 2024.04.22.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 125.0.6422.112
Safari: 17.4.1
npmPackages:
svelte: 5.0.0-next.144 => 5.0.0-next.144
Severity
blocking an upgrade
Metadata
Metadata
Assignees
Labels
No labels