Skip to content

Commit af7bfb8

Browse files
committed
Changed StoredDebugToolbar.from_store to always create panel keys.
This fixes the issue where panels that don't call record_stats aren't fetchable in render_panel.
1 parent 992ed5c commit af7bfb8

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

debug_toolbar/toolbar.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,8 @@ def from_store(cls, request_id, panel_id=None):
221221
if panel_id and panel.panel_id != panel_id:
222222
continue
223223
data = toolbar.store.panel(toolbar.request_id, panel.panel_id)
224-
if data:
225-
panel.load_stats_from_store(data)
226-
toolbar._panels[panel.panel_id] = panel
224+
panel.load_stats_from_store(data)
225+
toolbar._panels[panel.panel_id] = panel
227226
return toolbar
228227

229228

docs/changes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Pending
88
* Removed logging about the toolbar failing to serialize a value into JSON.
99
* Moved the the import statement of ``debug_toolbar.urls`` to within the if
1010
statement's scope on the installation documentation.
11+
* Changed ``StoredDebugToolbar.from_store`` to always create a panel key and
12+
class instance, regardless if any data was generated.
1113

1214
6.0.0 (2025-07-22)
1315
------------------

tests/panels/test_history.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from django.urls import resolve, reverse
66

77
from debug_toolbar.panels.history import HistoryPanel
8+
from debug_toolbar.panels.redirects import RedirectsPanel
89
from debug_toolbar.store import get_store
910
from debug_toolbar.toolbar import DebugToolbar
1011

@@ -80,6 +81,7 @@ class HistoryViewsTestCase(IntegrationTestCase):
8081
"AlertsPanel",
8182
"CachePanel",
8283
"SignalsPanel",
84+
"ProfilingPanel",
8385
}
8486

8587
def test_history_panel_integration_content(self):
@@ -138,6 +140,7 @@ def test_history_sidebar_includes_history(self):
138140
self.client.get("/json_view/")
139141
panel_keys = copy.copy(self.PANEL_KEYS)
140142
panel_keys.add(HistoryPanel.panel_id)
143+
panel_keys.add(RedirectsPanel.panel_id)
141144
request_id = list(get_store().request_ids())[0]
142145
data = {"request_id": request_id}
143146
response = self.client.get(reverse("djdt:history_sidebar"), data=data)

0 commit comments

Comments
 (0)