Skip to content

Conversation

@vursen
Copy link
Contributor

@vursen vursen commented May 28, 2021

Description

When calling setProperties(...) to re-render a Polymer template instance, it compares the new properties with old ones using the === operator to skip rendering not changed properties.

However, in case of an object property, the === operator can't determine whether the object has been mutated inside. Thus, the property won't be re-rendered when mutated.

This issue appears in the template renderer when mutating the model.item object after it is bound to a template.

This PR introduces a workaround that forces model.item template bindings to re-render even the new item is strictly equal to the old item.

Type of change

  • Bugfix

Checklist

  • I have read the contribution guide: https://vaadin.com/docs-beta/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

@vursen vursen force-pushed the feat/template-renderer/support-mutated-properties branch from 98ecba8 to 923bdc0 Compare May 28, 2021 14:14
@vursen vursen changed the title fix: update bindings of model's item when re-rendering template fix: force model.item.* bindings to update when re-rendering template May 28, 2021
@vursen vursen requested review from tomivirkki and web-padawan May 28, 2021 14:16
@vursen vursen changed the title fix: force model.item.* bindings to update when re-rendering template fix: force model's item bindings to update when re-rendering template May 28, 2021
@vursen vursen changed the title fix: force model's item bindings to update when re-rendering template fix: force re-rendering of model's item bindings in template renderer May 28, 2021
@vursen vursen changed the title fix: force re-rendering of model's item bindings in template renderer fix: force model's item bindings to re-render in template renderer May 29, 2021
@vursen vursen force-pushed the feat/template-renderer/support-mutated-properties branch 2 times, most recently from 62dac67 to 6b82b9b Compare May 31, 2021 06:28
@vursen vursen force-pushed the feat/template-renderer/support-mutated-properties branch from 6b82b9b to ad01418 Compare May 31, 2021 06:31
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vlukashov vlukashov added the no-polymer Removing Polymer from Vaadin public APIs label May 31, 2021
@vlukashov vlukashov removed the request for review from web-padawan May 31, 2021 07:11
@vursen vursen merged commit 9423717 into master May 31, 2021
@vursen vursen deleted the feat/template-renderer/support-mutated-properties branch May 31, 2021 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-polymer Removing Polymer from Vaadin public APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants