Why does liveview delete destory element every time path changes

i am trying to add react in liveview, so far i able to add react into liveview using hooks. it works perfectly fine.
But one thing i noticed in the console whenever the path changes
from /docs to /articles
i see this log in the console

 phx-F8Im8F5XBaaqGGGi destroyed: the child has been removed from the parent -  undefined
 phx-F8Im8F5XBaaqGGGi mount:  -

i’m not sure why live view is removing the elemnt even though it is in the same session.

can anyone help me understand why it removes the element.


Hello and welcome!

LiveView stores it states on the server and therefore syncs the frontend with the state it has on the server. This will blow away and client-side only changes that aren’t done via JS Commands. You need to add phx-update="ignore" (more info) to any container that is being manipulated client-side by an external library.

1 Like

That works.
Thanks alot.