Skip to content

fix(dashboard): make system default/dark themes assignable to a dashboard - #44361

Open
sadpandajoe wants to merge 2 commits into
masterfrom
ultraset-fix-37289
Open

sadpandajoe wants to merge 2 commits into
masterfrom
ultraset-fix-37289

Conversation

@sadpandajoe

Copy link
Copy Markdown
Member

SUMMARY

The dashboard properties "Theme" dropdown fetches /api/v1/theme/ with an is_system eq false filter (superset-frontend/src/dashboard/components/PropertiesModal/index.tsx), which hides the two system themes. Contrary to a GitHub bot comment on the issue claiming THEME_DEFAULT/THEME_DARK are "not stored as database rows," SeedSystemThemesCommand (superset/commands/theme/seed.py) already upserts them as Theme rows with is_system=True on every app start (superset/app.py -> sync_config_to_db). Since user-created themes are always created with is_system=False (superset/themes/api.py), the client-side filter is exactly what hid the two system themes from the picker — no backend/schema change is needed. This PR removes that filter so THEME_DEFAULT/THEME_DARK become selectable, letting a dashboard be pinned to a specific theme regardless of a viewer's OS/browser dark-mode preference (the reported use case: dashboards with custom CSS written for a light theme break when a viewer's system prefers dark).

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No screenshots captured — this environment has no running Superset instance to render the dropdown against. The change and its effect (system themes appear as extra options in dashboard-theme-select) are covered by the added Jest regression test instead.

TESTING INSTRUCTIONS

  1. Start Superset with the default config (THEME_DEFAULT/THEME_DARK set, ENABLE_UI_THEME_ADMINISTRATION = True).
  2. Open a dashboard -> Edit properties -> Styling -> Theme dropdown.
  3. Before this change: only custom themes created via Settings -> Themes appear.
  4. After this change: THEME_DEFAULT and THEME_DARK also appear and can be assigned; the dashboard renders with the assigned theme regardless of the viewer's dark-mode preference.

ADDITIONAL INFORMATION

  • Has associated issue: Fixes System default themes should be available for assignment to a dashboard #37289
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

…oard

The dashboard properties "Theme" dropdown fetched /api/v1/theme/ with an
is_system=false filter, hiding the two config-seeded system themes
(THEME_DEFAULT/THEME_DARK) even though SeedSystemThemesCommand already
persists them as Theme rows on every app boot. Users could not pin a
dashboard to a specific system theme to keep custom CSS stable regardless
of viewer dark-mode preference.

Fixes #37289
@bito-code-review

bito-code-review Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #1a5d22

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/dashboard/components/PropertiesModal/PropertiesModal.test.tsx - 1
    • Stale fetch-mock call race · Line 691-703
      `fetchMock` history is only cleared in `afterAll` (line 150), not `beforeEach`, and earlier tests in this file also render `PropertiesModal` and trigger the theme fetch. So `waitFor` at line 691 can resolve on a stale call, and `themeCalls[themeCalls.length - 1]` (line 698) may not be the current render's request, weakening the `col:is_system` assertion. Capture a baseline count before `render` and assert the count increased.
Review Details
  • Files reviewed - 2 · Commit Range: 5797092..6aea5c5
    • superset-frontend/src/dashboard/components/PropertiesModal/PropertiesModal.test.tsx
    • superset-frontend/src/dashboard/components/PropertiesModal/index.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.28%. Comparing base (dca54da) to head (6aea5c5).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #44361      +/-   ##
==========================================
- Coverage   80.28%   80.28%   -0.01%     
==========================================
  Files        2929     2929              
  Lines      174176   174176              
  Branches    40450    40450              
==========================================
- Hits       139843   139840       -3     
- Misses      31676    31679       +3     
  Partials     2657     2657              
Flag Coverage Δ
javascript 75.69% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System default themes should be available for assignment to a dashboard

1 participant