From 3c5316833f5fff67eab45eddbf2be9643481ecbf Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Wed, 6 Nov 2024 08:50:49 -0800 Subject: [PATCH] fix: improved warning message for legacy non-reactive properties --- .../docs/98-reference/.generated/compile-warnings.md | 2 +- packages/svelte/messages/compile-warnings/script.md | 2 +- packages/svelte/src/compiler/warnings.js | 4 ++-- .../warnings.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/documentation/docs/98-reference/.generated/compile-warnings.md b/documentation/docs/98-reference/.generated/compile-warnings.md index 775e0681c9..180bcaf0c5 100644 --- a/documentation/docs/98-reference/.generated/compile-warnings.md +++ b/documentation/docs/98-reference/.generated/compile-warnings.md @@ -729,7 +729,7 @@ Reassignments of module-level declarations will not cause reactive statements to ### reactive_declaration_non_reactive_property ``` -Properties of objects and arrays are not reactive unless in runes mode. Changes to this property will not cause the reactive statement to update +Arrays and object properties are only reactive in runes mode. This may be unexpected if referencing an imported runes-based object and the behavior of this statement will change when migrating to runes mode. ``` ### script_context_deprecated diff --git a/packages/svelte/messages/compile-warnings/script.md b/packages/svelte/messages/compile-warnings/script.md index 293f065ba7..eeb370460f 100644 --- a/packages/svelte/messages/compile-warnings/script.md +++ b/packages/svelte/messages/compile-warnings/script.md @@ -28,7 +28,7 @@ ## reactive_declaration_non_reactive_property -> Properties of objects and arrays are not reactive unless in runes mode. Changes to this property will not cause the reactive statement to update +> Arrays and object properties are only reactive in runes mode. This may be unexpected if referencing an imported runes-based object and the behavior of this statement will change when migrating to runes mode. ## state_referenced_locally diff --git a/packages/svelte/src/compiler/warnings.js b/packages/svelte/src/compiler/warnings.js index bd28956230..bb614e524c 100644 --- a/packages/svelte/src/compiler/warnings.js +++ b/packages/svelte/src/compiler/warnings.js @@ -642,11 +642,11 @@ export function reactive_declaration_module_script_dependency(node) { } /** - * Properties of objects and arrays are not reactive unless in runes mode. Changes to this property will not cause the reactive statement to update + * Arrays and object properties are only reactive in runes mode. This may be unexpected if referencing an imported runes-based object and the behavior of this statement will change when migrating to runes mode. * @param {null | NodeLike} node */ export function reactive_declaration_non_reactive_property(node) { - w(node, "reactive_declaration_non_reactive_property", "Properties of objects and arrays are not reactive unless in runes mode. Changes to this property will not cause the reactive statement to update"); + w(node, "reactive_declaration_non_reactive_property", "Arrays and object properties are only reactive in runes mode. This may be unexpected if referencing an imported runes-based object and the behavior of this statement will change when migrating to runes mode."); } /** diff --git a/packages/svelte/tests/validator/samples/reactive-statement-non-reactive-import-statement/warnings.json b/packages/svelte/tests/validator/samples/reactive-statement-non-reactive-import-statement/warnings.json index 4184902753..32a4e669c2 100644 --- a/packages/svelte/tests/validator/samples/reactive-statement-non-reactive-import-statement/warnings.json +++ b/packages/svelte/tests/validator/samples/reactive-statement-non-reactive-import-statement/warnings.json @@ -1,7 +1,7 @@ [ { "code": "reactive_declaration_non_reactive_property", - "message": "Properties of objects and arrays are not reactive unless in runes mode. Changes to this property will not cause the reactive statement to update", + "message": "Arrays and object properties are only reactive in runes mode. This may be unexpected if referencing an imported runes-based object and the behavior of this statement will change when migrating to runes mode.", "start": { "line": 4, "column": 11