Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove reactive_declaration_non_reactive_property warning #14111

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/happy-carpets-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: remove `reactive_declaration_non_reactive_property` warning
Original file line number Diff line number Diff line change
Expand Up @@ -726,12 +726,6 @@ Reactive declarations only exist at the top level of the instance script
Reassignments of module-level declarations will not cause reactive statements to update
```

### 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
```

### script_context_deprecated

```
Expand Down
4 changes: 0 additions & 4 deletions packages/svelte/messages/compile-warnings/script.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@

> Reassignments of module-level declarations will not cause reactive statements to update

## 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

## state_referenced_locally

> State referenced in its own scope will never update. Did you mean to reference it inside a closure?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,5 @@ export function MemberExpression(node, context) {
context.state.analysis.needs_context = true;
}

if (context.state.reactive_statement) {
const left = object(node);

if (left !== null) {
const binding = context.state.scope.get(left.name);

if (binding && binding.kind === 'normal') {
const parent = /** @type {Node} */ (context.path.at(-1));

if (
binding.scope === context.state.analysis.module.scope ||
binding.declaration_kind === 'import' ||
(binding.initial &&
binding.initial.type !== 'ArrayExpression' &&
binding.initial.type !== 'ObjectExpression' &&
binding.scope.function_depth <= 1)
) {
if (parent.type !== 'MemberExpression' && parent.type !== 'CallExpression') {
w.reactive_declaration_non_reactive_property(node);
}
}
}
}
}

context.next();
}
9 changes: 0 additions & 9 deletions packages/svelte/src/compiler/warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export const codes = [
"perf_avoid_nested_class",
"reactive_declaration_invalid_placement",
"reactive_declaration_module_script_dependency",
"reactive_declaration_non_reactive_property",
"state_referenced_locally",
"store_rune_conflict",
"css_unused_selector",
Expand Down Expand Up @@ -641,14 +640,6 @@ export function reactive_declaration_module_script_dependency(node) {
w(node, "reactive_declaration_module_script_dependency", "Reassignments of module-level declarations will not cause reactive statements to update");
}

/**
* Properties of objects and arrays are not reactive unless in runes mode. Changes to this property will not cause the reactive statement to update
* @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");
}

/**
* State referenced in its own scope will never update. Did you mean to reference it inside a closure?
* @param {null | NodeLike} node
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.