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

Autosubscribed stores no longer listed as referenced in vars #4081

Closed
Conduitry opened this issue Dec 10, 2019 · 6 comments · Fixed by #4089
Closed

Autosubscribed stores no longer listed as referenced in vars #4081

Conduitry opened this issue Dec 10, 2019 · 6 comments · Fixed by #4089
Labels

Comments

@Conduitry
Copy link
Member

Describe the bug
Since #3945, autosubscribing to a store within the template no longer causes the store to be marked as referenced: true in the vars response from the compiler.

Logs
n/a

To Reproduce

<script>
	let store;
</script>
{$store}

Compile this, and look at the vars value in the response. store has referenced: false.

Expected behavior
store should have referenced: true.

Stacktraces
n/a

Information about your Svelte project:
Svelte 3.16.0, 3.16.1

Severity
Moderate. Causing new incorrect warnings in the ESLint plugin - sveltejs/eslint-plugin-svelte3#49

Additional context
Unlike the above, this seems to be working correctly:

<script>
	let store;
	$store;
</script>
@ghost
Copy link

ghost commented Dec 10, 2019

Another interesting thing is that $store has referenced: true in the first case but not the second. Looking at the debugger, the first case only calls add_reference on the $store variable name.

There's code in that method here to check for an auto-subscribe so we should probably just also tag it with referenced = true.

PR on the way... just running CI tests now.

@ghost
Copy link

ghost commented Dec 10, 2019

Bah... marking the store as referenced creates a codegen test failure....
image

@ghost
Copy link

ghost commented Dec 10, 2019

Actually, I think the change to the expected output is OK since it used to be there before @Rich-Harris made his changes (though in a different order).

@anlexN
Copy link

anlexN commented Dec 11, 2019

@Conduitry why do you have to use this syntax?

@Conduitry
Copy link
Member Author

What syntax? I'm not sure what you're asking.

@anlexN
Copy link

anlexN commented Dec 12, 2019

let store;
$store;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants