diff --git a/.changeset/dull-donkeys-smell.md b/.changeset/dull-donkeys-smell.md new file mode 100644 index 0000000000..31b1ac319d --- /dev/null +++ b/.changeset/dull-donkeys-smell.md @@ -0,0 +1,5 @@ +--- +"svelte": patch +--- + +fix: `$state.is` missing second argument on the server diff --git a/packages/svelte/src/compiler/phases/3-transform/server/transform-server.js b/packages/svelte/src/compiler/phases/3-transform/server/transform-server.js index 83bfc17d4e..0ac79f6655 100644 --- a/packages/svelte/src/compiler/phases/3-transform/server/transform-server.js +++ b/packages/svelte/src/compiler/phases/3-transform/server/transform-server.js @@ -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])) ); } diff --git a/packages/svelte/tests/server-side-rendering/samples/state-is/_expected.html b/packages/svelte/tests/server-side-rendering/samples/state-is/_expected.html new file mode 100644 index 0000000000..f9f47bcf0a --- /dev/null +++ b/packages/svelte/tests/server-side-rendering/samples/state-is/_expected.html @@ -0,0 +1,4 @@ +
true
+true
+true
+true
\ No newline at end of file diff --git a/packages/svelte/tests/server-side-rendering/samples/state-is/main.svelte b/packages/svelte/tests/server-side-rendering/samples/state-is/main.svelte new file mode 100644 index 0000000000..17a859cd87 --- /dev/null +++ b/packages/svelte/tests/server-side-rendering/samples/state-is/main.svelte @@ -0,0 +1,10 @@ + + +{a === obj}
+{$state.is(a, obj)}
+{a === b}
+{$state.is(a, b)}