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

compiler: tag auto-subscribe stores as referenced in vars #4089

Merged
merged 3 commits into from Dec 11, 2019
Merged

compiler: tag auto-subscribe stores as referenced in vars #4089

merged 3 commits into from Dec 11, 2019

Conversation

ghost
Copy link

@ghost ghost commented Dec 10, 2019

Fixes #4081

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases features are absent for a reason.
  • This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
  • Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to npm run lint!)

Tests

  • Run the tests tests with npm test or yarn test)

David A Kondrad added 3 commits December 10, 2019 13:09
Fixes unused variable warnings thrown by ESLint when using
auto-subscribe stores in templates.
Update test case to put it back to the way it was before bitmask commits.
Note the order of names is different; however, the code does the right thing.
@@ -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];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it'll cause any incorrect behavior, but it would be nice if this weren't added. Presumably the bitmask changes co-opted referenced to mean 'needed in the context array', which is also what caused this bug in the first place when that started being false for stores that are only accessed via autosubscription in the template. That may not be worth it to fix at this point though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's something interesting though...
If you add another normal variable that can't be hoisted, it gets put in the context list anyway.
This occurs in both current master as well as my branch.
https://svelte.dev/repl/e61b08c7da904ba7af9d005ebac0d2d2?version=3.16.3

So, yeah, it probably isn't a big enough issue to worry about.

@Conduitry Conduitry merged commit 6c0fb5b into sveltejs:master Dec 11, 2019
@ghost ghost deleted the gh-4081 branch December 11, 2019 18:12
taylorzane pushed a commit to taylorzane/svelte that referenced this pull request Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autosubscribed stores no longer listed as referenced in vars
1 participant