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

Component update code generated unnecessarily #3526

Closed
Rich-Harris opened this issue Sep 7, 2019 · 0 comments · Fixed by #3529
Closed

Component update code generated unnecessarily #3526

Rich-Harris opened this issue Sep 7, 2019 · 0 comments · Fixed by #3529
Labels

Comments

@Rich-Harris
Copy link
Member

Describe the bug

A component with no props that could change will nevertheless get update code generated

To Reproduce

https://svelte.dev/repl/f26f7150be604723a047981635d30d0e?version=3.9.2

Expected behavior

	return {
		c() {
			foo.$$.fragment.c();
		},

		m(target, anchor) {
			mount_component(foo, target, anchor);
			current = true;
		},

-		p(changed, ctx) {
-			var foo_changes = {};
-			if (changed.y) foo_changes.x = y;
-			foo.$set(foo_changes);
-		},
+		noop,

		i(local) {
			if (current) return;
			transition_in(foo.$$.fragment, local);

			current = true;
		},

		o(local) {
			transition_out(foo.$$.fragment, local);
			current = false;
		},

		d(detaching) {
			destroy_component(foo, detaching);
		}
	};

Severity

Low

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.

1 participant