diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index 4402a4a947..2c7fb64b67 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -203,7 +203,10 @@ export default class Component { const subscribable_name = name.slice(1); const variable = this.var_lookup.get(subscribable_name); - if (variable) variable.subscribable = true; + if (variable) { + variable.referenced = true; + variable.subscribable = true; + } } else { this.used_names.add(name); } diff --git a/test/js/samples/component-store-access-invalidate/expected.js b/test/js/samples/component-store-access-invalidate/expected.js index 151bd6ed0e..4c7bfd7009 100644 --- a/test/js/samples/component-store-access-invalidate/expected.js +++ b/test/js/samples/component-store-access-invalidate/expected.js @@ -43,7 +43,7 @@ function instance($$self, $$props, $$invalidate) { let $foo; const foo = writable(0); component_subscribe($$self, foo, value => $$invalidate(0, $foo = value)); - return [$foo]; + return [$foo, foo]; } class Component extends SvelteComponent { diff --git a/test/vars/samples/store-referenced/_config.js b/test/vars/samples/store-referenced/_config.js index cb92b67ea4..bac35d1dba 100644 --- a/test/vars/samples/store-referenced/_config.js +++ b/test/vars/samples/store-referenced/_config.js @@ -8,7 +8,7 @@ export default { module: false, mutated: false, reassigned: false, - referenced: false, + referenced: true, referenced_from_script: false, writable: true },