Infinte DOM with finite state
Your view's state is limited to a certain amount of memory when serialized. When building things like a chat app, often you wan't the past history of events to be saved without having to keep them in memory.
Typically, Live HTML will replace divs in a when the list changes. Utilizing the assemble-update
binding we can instead append or prepend the div. You must set a unique ID on the parent element and for each child element
#
Putting it all togetherThe below example will keep all events in view even though one event is kept in memory. Because after each event the ID is unique, Live HTML will prepend the container to the list.
Quick view for details and to fork.
#
More infoRefer to the LiveView docs for more information about the binding.