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

feat: warn if component is expected to be reactive #4409

Merged

Conversation

tanhauhau
Copy link
Member

Fixes #4331

if (variable.reassigned || variable.export_name || variable.is_reactive_dependency) {
this.renderer.component.warn(this.node, {
code: 'reactive-component',
message: `<${name} /> will not be reactive. Use <svelte:component this={${name}} /> if you want reactivity.`,
Copy link
Member

Choose a reason for hiding this comment

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

This makes it sound like <Foo/> isn't reactive at all, when we should just be telling the user that it won't change when Foo changes. I'm not sure how to word this.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe ' will not be reactive if Foo changes. Use <svelte:component this={Foo}/>' if you want this reactivity.'?

@Conduitry Conduitry merged commit fdc89eb into sveltejs:master Feb 15, 2020
jesseskinner pushed a commit to jesseskinner/svelte that referenced this pull request Feb 27, 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.

Warn if Foo is reassigned and using <Foo/>
2 participants