pull/11610/head
Dominic Gannaway 2 years ago
parent 0e526bc531
commit c4303387d9

@ -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.

@ -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) {

@ -79,7 +79,7 @@ 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");

Loading…
Cancel
Save