I have some stateful custom elements in an array. These custom elements can be sorted based off some criteria. I’m noticing that when I sort the array some of the custom elements are removed from the page and then added back in. This means the lifecycle functions are invoked for the items that were moved(bind, attached, etc) and I lose the current state of these elements.
I understand that it may be necessary to remove and insert fragments, but is it possible to keep the state of these custom elements when sort occurs? I’d rather not store the state in another object, I don’t really have any need to persist or share this state, I just don’t want to lose it when the user is interacting with a sort button.