You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Standard web component has 3 key lifecycle point: create(constructor), connected, disconnected. This is because an element may be remove from dom and added back again and again. With these hooks, we could create something in constructure but reuse them from time to time.
But lifecycles defined by this repo are only create and release, which means we have to recreate all thing after reconnecting.
Am I missing something? Or how could we handle this?
The text was updated successfully, but these errors were encountered:
Yeah. I built this so that while it can handle moves that when the element has been disconnected I free up reactivity (basically dispose) and when connected I create again. I'm not sure if there is a way around this because otherwise we'd have potential memory leaks and there is no onDispose hook in the native DOM only disconnect. I have no way to automatically cleanup after ourselves.
Not sure if there is some clever trick I'm missing but this is just one of those things that I've considered from the beginning since I was dealing with reactive libraries which innately have leaky observer potential. Using something like a WeakMap is non-starter since besides not being able to change other libraries internals they can't be iterated on as subscriptions. We need a definite even to tie into to free up long live subscriptions. At which point we need to re-evaluate all those computations again which I basically can't do without recreation.
Standard web component has 3 key lifecycle point: create(constructor), connected, disconnected. This is because an element may be remove from dom and added back again and again. With these hooks, we could create something in constructure but reuse them from time to time.
But lifecycles defined by this repo are only
create
andrelease
, which means we have to recreate all thing after reconnecting.Am I missing something? Or how could we handle this?
The text was updated successfully, but these errors were encountered: