fix: `$state.is` missing second argument on the server (#11835)

* fix: `$state.is` missing second argument on the server

* chore: update test
pull/11840/head
Paolo Ricciuti 6 months ago committed by GitHub
parent 22e2aeca76
commit 82a645f8d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: `$state.is` missing second argument on the server

@ -791,7 +791,8 @@ const javascript_visitors_runes = {
if (rune === '$state.is') { if (rune === '$state.is') {
return b.call( return b.call(
'Object.is', '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]))
); );
} }

@ -0,0 +1,4 @@
<p>true</p>
<p>true</p>
<p>true</p>
<p>true</p>

@ -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>
Loading…
Cancel
Save