Avoid resetting state if component is disconnected then immediately reconnected
nolanlawson opened this issue · 1 comments
nolanlawson commented
I was reading about how Vue implements web components here:
When the element's
disconnectedCallback
is invoked, Vue will check whether the element is detached from the document after a microtask tick.
- If the element is still in the document, it's a move and the component instance will be preserved;
- If the element is detached from the document, it's a removal and the component instance will be unmounted.
This seems really sensible. I think we can do the same thing.