Repository navigation
perf(dashboard): look up the dashboard once per filter_state read - #46314
Merged
rusackas merged 1 commit intoNov 21, 2026
Merged
Conversation
GET /api/v1/dashboard/<id>/filter_state/<key> loaded and access-checked the dashboard twice: once in check_access and again in get_filter_names. Refreshing the entry in between commits and expires the session, so the second lookup also reloaded the user and their roles. check_access returns the dashboard it loaded, and the command keeps its metadata for get_filter_names.
Contributor
sadpandajoe
requested review from
aminghadersohi,
michael-s-molina,
rusackas and
villebro
November 18, 2026 18:01
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #46314 +/- ##
==========================================
- Coverage 85.43% 85.43% -0.01%
==========================================
Files 3100 3100
Lines 213566 213570 +4
Branches 50411 50412 +1
==========================================
+ Hits 182464 182467 +3
- Misses 27675 27676 +1
Partials 3427 3427
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rusackas
approved these changes
Nov 21, 2026
rusackas
left a comment
Member
There was a problem hiding this comment.
Thanks @uhyunpark, nice catch on the doubled lookup, and good call reading the metadata before the refresh commit expires it. LGTM!
jprinet
added a commit
to jprinet/superset
that referenced
this pull request
Nov 23, 2026
* origin/master: (393 commits) fix(a11y): name the semantic view description input (apache#46458) docs(semantic): explain datasource list modification eligibility (apache#46462) docs(semantic-layer): document NULL-preserving exclusion filters (apache#46447) fix(uploads): skip folder and system entries in columnar ZIP uploads (apache#45617) fix(i18n-es): promote 47 of the zero-context backfill entries (apache#45847) fix(mcp): return structured ChartError on SQLAlchemyError in get_chart_sql (apache#44351) fix(datasets): follow semantic view modification permissions (apache#46448) fix(docker): account for container memory limits in frontend-mem-nag.sh (apache#46373) fix(reports): carry the report's native filters in the email and Slack link (apache#46062) fix(explore): apply the dataset timezone to grained temporal filter values (apache#46175) fix(i18n): enforce the do-not-translate registry across the catalogs (apache#45974) chore(logging): log unparseable virtual dataset SQL at debug in the RLS lookup (apache#46139) fix(i18n): split parameter-suggestion plural into two messages (apache#46049) test(partition-mapping): cover Hive/Impala mirrored SQL, cache outage and migration (apache#46319) perf(dashboard): look up the dashboard once per filter_state read (apache#46314) fix(i18n): load the dayjs locale for every language with a catalog (apache#45982) test(semantic-layer): make date export parametrization deterministic (apache#46449) fix(oauth2): idempotent OAuth2 completion and resilient listener (apache#40292) fix(explore): prevent full table scan when SQL expression is used as x-axis (apache#41339) feat(mcp): radar chart type plugin (apache#43571) ... # Conflicts: # .github/workflows/docker.yml # .github/workflows/superset-frontend.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
GET /api/v1/dashboard/<id>/filter_state/<key>looks the dashboard up twice.check_accessloads it to check access, thenget_filter_names(added in #44043) loads it again to read the filter names. Each lookup runs the dashboard access filter andraise_for_access. With the default metastore-backed filter state cache, refreshing the entry between the two lookups commits and expires the session, so the second lookup also reloads the user with their roles and groups.This keeps the metadata from the first lookup:
check_accessreturns the dashboard it loaded, andGetFilterStateCommandholds itsjson_metadataforget_filter_names. The metadata is read before the refresh, because the commit expires the loaded dashboard.The frontend calls this endpoint when a dashboard opens with a
native_filters_keyin the URL.Metadata statements per request, counted with
before_cursor_executethrough the Flask test client on a SQLite metadata database with the default config:The counts are the same for a dashboard of 5 charts and one of 25.
Access is still checked once per request, before the stored value is read. The lookup removed here was a second check of the same dashboard for the same user in the same request.
get_filter_namesstill looks the dashboard up itself when it is called without a priorget, and the create, update and delete commands ignore the new return value ofcheck_access.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
pytest tests/unit_tests/dashboards/filter_state_api_test.pyThe new
test_get_looks_up_the_dashboard_oncechecks the response and that the dashboard is looked up once. On master it fails withExpected 'get_by_id_or_slug' to be called once. Called 2 times.To check by hand: open a dashboard with native filters, apply a filter and reload the page. The filter values are restored, and the
filter_state/<key>response still carriesvalueandnames.ADDITIONAL INFORMATION