diff --git a/src/compile/Component.ts b/src/compile/Component.ts index dd41a0a645..259144d691 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -1114,9 +1114,11 @@ export default class Component { if (!assignee_nodes.has(identifier)) { const { name } = identifier; const owner = scope.find_owner(name); + const component_var = component.var_lookup.get(name); + const is_writable_or_mutated = component_var && (component_var.writable || component_var.mutated); if ( (!owner || owner === component.instance_scope) && - (name[0] === '$' || component.var_lookup.has(name) && component.var_lookup.get(name).writable) + (name[0] === '$' || is_writable_or_mutated) ) { dependencies.add(name); } diff --git a/src/compile/render-dom/index.ts b/src/compile/render-dom/index.ts index 0a0743b2a0..1cd0664ecf 100644 --- a/src/compile/render-dom/index.ts +++ b/src/compile/render-dom/index.ts @@ -364,7 +364,7 @@ export default function dom( } const variable = component.var_lookup.get(n); - return variable && variable.writable; + return variable && (variable.writable || variable.mutated); }) .map(n => `$$dirty.${n}`).join(' || '); diff --git a/test/runtime/samples/reactive-value-mutate-const/_config.js b/test/runtime/samples/reactive-value-mutate-const/_config.js new file mode 100644 index 0000000000..da0a19dd28 --- /dev/null +++ b/test/runtime/samples/reactive-value-mutate-const/_config.js @@ -0,0 +1,17 @@ +export default { + html: ` + +