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

dom-repeat is wrong when attached/detached #4746

Closed
6 tasks done
kolesoffac opened this issue Jul 24, 2017 · 2 comments
Closed
6 tasks done

dom-repeat is wrong when attached/detached #4746

kolesoffac opened this issue Jul 24, 2017 · 2 comments

Comments

@kolesoffac
Copy link

kolesoffac commented Jul 24, 2017

Description

When i use <dom-repeat>, and when i remove item from items, in detached-method use last id.

Live Demo

https://codepen.io/anon/pen/ZJEXqB

Steps to Reproduce

Example:

  1. Load the page in the demo above.
  2. Observe "attached the DOM! - " logged in the console
  3. Press the button marked Remove first item

Expected Results

"attached the DOM! - " "0"
"attached the DOM! - " "1"
"attached the DOM! - " "2"
"detached the DOM! - " "0"

Actual Results

"attached the DOM! - " "0"
"attached the DOM! - " "1"
"attached the DOM! - " "2"
"detached the DOM! - " "2"

Browsers Affected

  • Chrome
  • Firefox
  • Edge
  • Safari 9
  • Safari 8
  • IE 11

Versions

  • Polymer: v2.0.2
  • webcomponents: v1.0.0
@sorvell
Copy link
Contributor

sorvell commented Aug 31, 2017

I believe this is the same basic issue as #1713. There's a fix in the works. @kevinpschaaf can you verify?

@kevinpschaaf kevinpschaaf added this to Planned in Embarcadero walk Nov 17, 2017
@sorvell sorvell moved this from Planned to In progress in Embarcadero walk Nov 28, 2017
@TimvdLippe TimvdLippe moved this from In progress to Planned in Embarcadero walk Nov 28, 2017
@TimvdLippe TimvdLippe self-assigned this Nov 28, 2017
@TimvdLippe
Copy link
Contributor

We have analyzed your use-case and understood the "unexpected behavior". <dom-repeat> reuses element nodes for performance reasons. The assumption that the property layer remains the same throughout the lifecycle of the custom elements thus becomes incorrect. As such, whenever layer changes, in the oberserver you need to update the value of id as well.

You can in the future workaround this issue with using the feature restamp on <dom-repeat>, which is tracked on #1713. Therefore I am closing this issue, feel free to subscribe to #1713.

Embarcadero walk automation moved this from Planned to Closed Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Embarcadero walk
  
Closed
Development

No branches or pull requests

4 participants