diff --git a/packages/svelte/messages/client-warnings/warnings.md b/packages/svelte/messages/client-warnings/warnings.md index 1f77457f94..785d17d59e 100644 --- a/packages/svelte/messages/client-warnings/warnings.md +++ b/packages/svelte/messages/client-warnings/warnings.md @@ -19,3 +19,7 @@ > Mutating a value outside the component that created it is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead > %component% mutated a value owned by %owner%. This is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead + +## state_proxy_equality_mismatch + +> Detected an equality check between a $state proxy and a non-$state-proxy object for %method%. This equality check will always fail because the proxy has a different object identity. Ensure both operands are of the same kind for accurate results. diff --git a/packages/svelte/src/internal/client/equality.js b/packages/svelte/src/internal/client/equality.js index 31275ecf53..791cd24423 100644 --- a/packages/svelte/src/internal/client/equality.js +++ b/packages/svelte/src/internal/client/equality.js @@ -77,7 +77,7 @@ export function state_is(a, b) { if (a != null && typeof a === 'object' && STATE_SYMBOL in a) { const o = a[STATE_SYMBOL]; if (o != null && object_is(o.p, b)) { - return true + return true; } } if (b != null && typeof b === 'object' && STATE_SYMBOL in b) { diff --git a/packages/svelte/src/internal/client/warnings.js b/packages/svelte/src/internal/client/warnings.js index 3c188e30e2..29d1d29034 100644 --- a/packages/svelte/src/internal/client/warnings.js +++ b/packages/svelte/src/internal/client/warnings.js @@ -79,9 +79,9 @@ export function ownership_invalid_mutation(component, owner) { */ export function state_proxy_equality_mismatch(method) { if (DEV) { - console.warn(`%c[svelte] ${"state_proxy_equality_mismatch"}\n%cDetected an equality check between a $state proxy and a non-$state-proxy object for ${method}. This equality check will always fail because the proxy has a different object identity. Ensure both operands are of the same kind for accurate results.`, bold, normal); + console.warn(`%c[svelte] ${"state_proxy_equality_mismatch"}\n%c${`Detected an equality check between a $state proxy and a non-$state-proxy object for ${method}. This equality check will always fail because the proxy has a different object identity. Ensure both operands are of the same kind for accurate results.`}`, bold, normal); } else { // TODO print a link to the documentation console.warn("state_proxy_equality_mismatch"); } -} +} \ No newline at end of file