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 mutation to imported variable #4713

Merged

Conversation

tanhauhau
Copy link
Member

Fixes #4555

  • Import statements were by default hoistable, making it unavailable in the context.
  • Make import declared variable non-hoistable if it is mutated somewhere. (import declared vars are read-only, cant be reassigned)
    • or should i created another flag for the var instead of changing the behavior of hoistable ?
    • import statements are hoisted by default, so changing hoistable seemed safe.

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)

@tanhauhau tanhauhau changed the title fix mutating import statement fix mutation to imported variable Apr 24, 2020
@tanhauhau tanhauhau force-pushed the tanhauhau/reactive-import-statement branch from dfc2870 to 6f3d7be Compare April 24, 2020 00:19
@Conduitry
Copy link
Member

I think using hoistable for this makes sense - it's not one of the fields we expose in the vars array, and so we don't need to worry about changing a public API or anything.

@Conduitry Conduitry merged commit aabb23c into sveltejs:master Apr 24, 2020
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.

Assigning a prop to an imported object, breaks initial run of reactive statements
2 participants