fabbricadigitale / paper-chip

A chip web component made with Polymer 2 following Material Design guidelines

Home Page:http://webcomponents.org/element/fabbricadigitale/paper-chip

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chip removal causing chips rendering issues

magiccrafter opened this issue · comments

The issue is quite strange and interesting.
It can be reproduced with the examples from the demo page(i.e. the autocomplete demo with the countries).
https://www.webcomponents.org/element/fabbricadigitale/paper-chip/demo/demo/index.html

If a chip is removed from the head/beginning or anywhere but not the last the next chip is getting removed as well. In other words if we have 2 or more chips and remove any chip but not the last two chips are removed, the chip selected for remove and the next one. I thought that the issue is simple but after digging in the code it turned out a little more complex :)

The paper-chip's code for chip removal seems correct, the chip is getting removed accordingly and the array of values is spliced just fine. The Polymer's 'dom-repeat' renderer function is being called at the end wrapped in an asyc call and is doing a full template refresh after which we end up with this bug.

Hi @magiccrafter thanks for noticing it, you're right.

I'm pushing the solution. Soon, after some regression tests, we'll relase a patch version. Thanks a lot !