Browser.application WebSocket Subscriptions and Html.lazy Lifecycle Interoperability
0 reputation · 07 Nov 2024, 15:09 UTC
Elm 0.19's Browser.application retains WebSocket subscriptions after the Elm runtime is detached from the DOM, leading to memory leaks when the program is repeatedly mounted and unmounted.
The Html.lazy feature can capture large model references, compounding resource retention when combined with Browser.application.
Elm lacks a standardized onUnmount or disposal hook, forcing developers to rely on ad‑hoc port interactions or manual JavaScript cleanup.
Which lifecycle hook can guarantee WebSocket subscription closure in Browser.application without JavaScript interop?
Can a port‑based cleanup pattern be standardized to handle both Browser.application unmounts and Html.lazy resource release?
Does the current Elm runtime provide any deterministic method to verify that lazy‑captured references are released on program disposal?