jazzband / django-debug-toolbar

A configurable set of panels that display various debug information about the current request/response.
https://django-debug-toolbar.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
7.97k stars 1.03k forks source link

New AJAX request resets whole view if HistoryPanel is enabled. #1843

Closed PetrDlouhy closed 5 months ago

PetrDlouhy commented 8 months ago

Maybe I am doing something wrong, but I find working with DDT with HistoryPanel enabled quite annoying.

I have notifications on my website which makes request every ~5 seconds if there is anything new.

If I have HistoryPanel enabled in DDT this means that if I am exploring some request (from history or just the last one) and this AJAX notification request is made I loose everything I am seeing and the whole DDT resets to the newest (notification) request.

Would it be possible to set DDT so that it switches the request only if I explicitly select it from history?

matthiask commented 8 months ago

Makes sense to me. I have also been annoyed by this behavior at times. I think automatically refreshing the history panel should stay, but it shouldn't automatically switch to the newest request in case the newest request used XHR/fetch or something. That's just my opinion though.

If someone uses something like htmx/hotwire/turbolinks for navigation (https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#htmx) we should have a solution there as well, so that those users still get the auto update if possible. Maybe they have to opt in to updating to always the last request if distinguishing htmx boosts and other fetch-es isn't possible, but that would be acceptable.

tim-schilling commented 8 months ago

I like this improvement. I've tolerated it as well. I like the idea of putting it in local storage to keep track of what was configured.

tim-schilling commented 8 months ago

@PetrDlouhy do you have the availability implement a solution for this?

PetrDlouhy commented 8 months ago

I don't have very much time right now, but I might get to it some time. Probably next time I would bump into this issue.