Whenever the chat is updated, the class value is reset to the default visibility. I’ve put
phx-ignore on the element, but the problem persists.
I know I could add server-side logic to handle this, but that would add a round-trip for a really simple client-side toggle, so I’d prefer not to do that.
Mostly, I just want to know why this is happening. The element in question isn’t being touched by the diffs, which I can see in the intercepts, and the function to toggle isn’t being executed, which I can see from the logs. What’s actually happening here?
I’ve found some discussion on the issue here: Elixir phoenix LiveView collapsible collapses on update - Stack Overflow - but the suggestion is to use localStorage, which I think is total overkill, and doesn’t explain what’s actually happening.
So, can anybody tell me what’s actually going on here (and hopefully how to avoid it)?