Skip to content

Conversation

@abdibaker
Copy link
Contributor

Description

This commit addresses the KeyError issue that occurs when using DatabaseStore with dynamically added panels to DEBUG_TOOLBAR_PANELS. The problem occurred in StoredDebugToolbar.from_store() where the method would only load panels that had stored data, causing a KeyError when accessing panels that were added after the initial request.

The fix modifies the panel loading logic to:

  1. Always load all configured panels regardless of stored data existence
  2. Properly set the from_store flag for panels that have stored data
  3. Maintain backward compatibility while ensuring graceful handling of missing panel data

This ensures that the toolbar works correctly when panels are dynamically added to the configuration, particularly when using DatabaseStore for persistent storage.

Fixes #2166

Checklist:

  • I have added the relevant tests for this change.
  • I have added an item to the Pending section of docs/changes.rst.

@abdibaker abdibaker closed this Aug 15, 2025
@tim-schilling
Copy link
Member

Hi @abdibaker, did you mean to close this?

@abdibaker
Copy link
Contributor Author

Yes I closed it I will open another pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gracefully handle panels that don't exist

2 participants