Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dull-donkeys-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"svelte": patch
---

fix: `$state.is` missing second argument on the server
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,8 @@ const javascript_visitors_runes = {
if (rune === '$state.is') {
return b.call(
'Object.is',
/** @type {import('estree').Expression} */ (context.visit(node.arguments[0]))
/** @type {import('estree').Expression} */ (context.visit(node.arguments[0])),
/** @type {import('estree').Expression} */ (context.visit(node.arguments[1]))
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<p>true</p>
<p>true</p>
<p>true</p>
<p>true</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script>
const obj = {};
const a = $state(obj)
const b= $state(obj)
</script>

<p>{a === obj}</p>
<p>{$state.is(a, obj)}</p>
<p>{a === b}</p>
<p>{$state.is(a, b)}</p>