Elm maintainers: where would be the best place to document this use case? I'd hate for this to be lost in a sea of threads.
On Tuesday, January 31, 2017 at 10:41:51 AM UTC-6, Joe Andaverde wrote: > > The DOM could still be invalidated and redrawn at any time by virtual-dom. > I haven't studied the code to see when it decides to recreate an element. > > On Monday, January 30, 2017 at 11:57:38 AM UTC-6, Josh Szmajda wrote: >> >> Do you think it's a viable alternate solution for now for an application >> to not unload any elements connected via ports and simply to hide them >> instead? Would certainly prefer your lifecycle events idea but thinking >> about near-term workarounds.. >> >> On Saturday, January 28, 2017 at 11:27:17 PM UTC-5, Joe Andaverde wrote: >>> >>> Statement: Elm is difficult to adopt for some groups because they >>> require UI controls that may be difficult or time-prohibitive to >>> re-implement. >>> >>> Current Approach: Use ports to initialize controls by passing the id of >>> a DOM element to use as the container. >>> >>> Problem: Using ports to wire UI controls can cause memory leaks because >>> there's no indication when a DOM element has been removed. When these DOM >>> elements disappear there's no way to clean up event handlers or other GC >>> roots. >>> >>> Due Diligence: I've put together an example of one type of memory leak >>> that's possible using a jQuery Date picker control: >>> >>> https://github.com/joeandaverde/elm-jquery-memory-leak >>> >>> The README contains a short gif of the memory leak in action. >>> >>> Solutions to being notified when a DOM element is created or removed >>> have been proposed in various (closed) issues in virtual-dom and this list. >>> I understand these lifecycle hooks have been acknowledged as a useful tool. >>> I propose that these lifecycle hooks are more than a convenience and >>> instead required in order to prevent memory leaks and aid adoption of Elm. >>> >>> >>> -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
