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 component object property binding unwanted init reflow #5890

Merged
merged 6 commits into from
Feb 8, 2021

Conversation

pushkine
Copy link
Contributor

@pushkine pushkine commented Jan 16, 2021

This is part of Svelte's issue with flagging objects and its overreliance on equality checks
Object bindings however can in part sidestep the issue in cases where a property is specified, as those often happen to be primitives, they may be checked instead
Fixes #3075, Fixes #4447, Fixes #5555

<Component bind:value={obj.property} />
function component0_value_binding(value) {
+	if ($$self.$$.not_equal(obj.property, value)) {
		obj.property = value;
		$$invalidate(1, obj);
+	}
}

@Conduitry Conduitry merged commit a9c1dc9 into sveltejs:master Feb 8, 2021
@pushkine pushkine deleted the fix-binding branch February 9, 2021 13:17
hontas added a commit to hontas/svelte that referenced this pull request Feb 11, 2021
* 'master' of https://github.com/sveltejs/svelte: (129 commits)
  -> v3.32.3
  fix remove of lone :host selectors (sveltejs#5984)
  -> v3.32.2
  update changelog
  fix extra invalidation with component prop binding to object property (sveltejs#5890)
  update css-tree@^1.1.2 (sveltejs#5958)
  fix :host and :global css scoping (sveltejs#5957)
  Tutorial : a better explanation of component events (sveltejs#4639)
  "What's new in Svelte" February newsletter (sveltejs#5925)
  Change color on 404 page (sveltejs#5932)
  -> v3.32.1
  warn module variables are nonreactive and make them truly nonreactive (sveltejs#5847)
  update changelog
  fix: "foreign" namespace elements should still allow binding 'this' (sveltejs#5942)
  inline `prop_values` in `init` helper (sveltejs#5909)
  update changelog
  don't create class update functions when dependencies aren't reactive (sveltejs#5926)
  fix extraneous store subscription in SSR (sveltejs#5929)
  make `SvelteComponentDev` typings more forgiving (sveltejs#5937)
  make animation/transition params optional (sveltejs#5936)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants