-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Adds restamp
mode to dom-repeat.
#4363
Conversation
@kevinpschaaf please rebase |
6758069
to
6cebeac
Compare
Is this PR still in progress? I see that the tests pass on chrome but timeout on firefox. Is there any ETA for this being functional? |
The customElements.get function was undefined until the polyfill resolved the HTMLImports. Instead of waiting for the imports to resolve and modifying the prototype, it was easier to extract a function that does the logic, as the prototype was not properly propagated in non-Chrome browsers
@azakus Rebased and fixed the tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Any updates about when this will be available? Have been waiting for this for a while. |
The change was reverted as @kevinpschaaf and @sorvell wanted to improve the API, but wasnt in the PR. We should be able to get the ball rolling again soon! |
@TimvdLippe, @sorvell Would be nice if you could let us know the reasons for reverting the PR and what are the use cases that the API needs to cater to. Thanks for all the great work... |
@sushantbs Paging that to @kevinpschaaf and @sorvell who wanted to have some more discussion and tackle some issues. I am not aware of the enhancements they want to make to this PR 😄 |
Fixes #1713 When restamp is true, template instances are never reused with different items. Instances mapping to current items are moved to their new location, new instances are created for any new items, and instances for removed items are discarded. This mode is generally more expensive than restamp: false as it results in more instances to be created and discarded during updates and disconnection/reconnection churn. By default, object identity is used for mapping instances to items. Set restampKey to provide key based identity. When restamp: true is used, restampKey can be used to provide a path into the item object that serves as a unique key for the item rather than using object identity, for purposes of mapping instances to items. Instances for items with the same key will be reused, while all others will be either restamped or discarded.
Would be nice to know what happened here. |
@TimvdLippe @kevinpschaaf @sorvell |
This implementation was put on hold, out of concern that the algorithm that was used to maintain key-instance identity was too simplistic and could have pathologically-bad performance as a result. In the interim, a more complicated but performance-optimized algorithm was implemented in |
Fixes #1713
When
restamp
is true, template instances are never reused with different items. Instances mapping to current items are moved to their new location, new instances are created for any new items, and instances for removed items are discarded. This mode is generally more expensive thanrestamp: false
as it results in more instances to be created and discarded during updates and disconnection/reconnection churn. By default, object identity is used for mapping instances to items. SetrestampKey
to provide key based identity.When
restamp: true
is used,restampKey
can be used to provide a path into the item object that serves as a unique key for the item rather than using object identity, for purposes of mapping instances to items. Instances for items with the same key will be reused, while all others will be either restamped or discarded.