JohnnyCurran / TimeTravel

Phoenix LiveView TimeTravel Debugger
MIT License
114 stars 0 forks source link

Why does the list item assign disappear when interacting with the counter? #15

Open mekhami opened 1 year ago

mekhami commented 1 year ago

In the debugger panel, when you increment or decrement the counter, the list of items that you previously added in the demo disappears.

Why is that? I would want to see all of the assigns for the liveview, not specifically the ones being changed. most often, the bugs we uncover are due to unexpected state changes, not the expected ones.

also is there a better place to ask questions for this project?

JohnnyCurran commented 1 year ago

Hi @mekhami ,

This is a good place to ask questions for the project.

I'm afraid I might not entirely understand your question, however. At any point in the slider, all of the LiveView assigns at that point in time are shown in the side pane.

The slider restores the state of the LiveView assigns at any given point. If, for instance, you add 3 items and remove 1, (4 interactions), slider positions 1 to 3 will have 1, 2, and 3 list items, respectively. The 4th slider position will have 2 list items since the 4th interaction removed one.

I assume you are referring to the video posted at https://github.com/JohnnyCurran/TimeTravelDemo#example ?

If you are talking about when the list items disappear from the pane when interacting with the LiveComponents (counters) that is a side-effect of the current implementation. The plan for future releases is to have the entire DOM / LiveView / LiveComponent tree available to inspect at any point in time.

Does this help answer your question? Happy to clarify anything else

mekhami commented 1 year ago

Hi, thanks for responding.

At that video, at 0:02, you click on one of the counters. When you do, the list of items that you have added to the live view no longer show up in the "assigns" section of the debug panel, despite them clearly still being part of the liveview state.

Not being able to view the state of the list items when you touch the counters is the part that i'm referring to. You've said "the plan for future releases is..." etc, and that's good enough for me! I'm very excited about this project.

JohnnyCurran commented 1 year ago

I think you raised a really good question so I'm gonna dive a little deeper into what's going on, why it happens, and the future plan:

This is not ideal and the reason this happens is because the state of the Live socket does not readily reveal the structure of the LiveView, its components, and their assigns.

In order to retrieve that data I need to:

So, in short, it's possible in a roundabout way. But that's probably the path going forward.

If, in the future, more information about the LiveSocket becomes available through LiveView itself that could change