vguillou / swipe-action

A Polymer element providing a declarative way to swipe DOM elements with configurable underlays and trigger some action when the swiping is done. Integrates seamlessly with the <iron-list> element.
https://vguillou.github.io/webcomponents/swipe-action
MIT License
15 stars 5 forks source link

Key request #4

Open OvermindDL1 opened 7 years ago

OvermindDL1 commented 7 years ago

To make more efficient updating, can a 'key' attribute or so be added to this, just whenever it changes from its previous value then reset the state of this? This would allow it to be used within dom-repeat when the items change on occasion (like removing them on delete), where currently if any are in a swiped state then they are still swiped even as the items are re-rendered with new content.

Basically just adding a new 'key' or 'keyed' or so property, have an observer on it, whenever it changes and does not equal its previous value then call this.reset(false) or so (perhaps with another property for whether it should be false/true?).

OvermindDL1 commented 7 years ago

To be specific, can work around it by iterating over the elements in a dom-repeat after it fills them (though can be slow), or can also use a calculated property based on some item key to set activatedActionId back to undefined, though both feel quite hacky to work around a lazy dom, a key would be setting a proper observable on the other hand