day8 / re-frame-10x

A debugging dashboard for re-frame. X-ray vision as tooling.
MIT License
631 stars 68 forks source link

Scrolling problem in the Event History panel #312

Closed Gregg8 closed 2 years ago

Gregg8 commented 3 years ago

When you select an event in the Event History panel, 10x will continuously scroll back to that event, which prevents you from scrolling to other events to view them.

In fact, the scrolling back only seems to happen when you've expanded the data for that event.

Gregg8 commented 2 years ago

This might be good to add to: https://github.com/day8/re-frame-10x/issues/302

MawiraIke commented 2 years ago

This issue is caused by triggering of componentDidUpdate in the lifecycle of selected epochs. I have been able to reproduce the issue when leaving mouse hover on a selected epoch. It seems that componentDidUpdate is triggered every time the mouse hovers (or leaves mouse hover) on a selected epoch. I think this is because we are tracking the current hovered epoch and updating the style of epochs depending on the mouse hover. This then updates the DOM and indirectly triggers the componentDidUpdate method. So every time a user moves the mouse from the selected epoch to another NOT selected epoch, we indirectly call componentDidUpdate and cause the DOM to scroll to the selected epoch again. @superstructor my suggestion is to stop listening to componentDidUpdate unless there was another intention of the callback that I have not discovered. Removing the callback seems to fix the issue.

superstructor commented 2 years ago

Ok thanks @MawiraIke I've reviewed the linked code and agree yes please stop listing to componentDidUpdate.