dosubot[bot] commented on issue #40704: URL: https://github.com/apache/superset/issues/40704#issuecomment-4677730354
<!-- Answer --> Great question — this is an important distinction for understanding the filter scope contract. **`chartsInScope` and `tabsInScope` are derived/runtime metadata, not persisted schema fields.** They should not be relied upon as stable API contracts by downstream consumers. Here's what's happening: - **Source of truth**: The `scope` object (`rootPath` + `excluded`) remains the canonical, persisted representation of filter scope. It's stored in the dashboard's `json_metadata` and included in exports [[1]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/commands/dashboard/export.py#L119-L135). - **Runtime derivation**: `chartsInScope` is computed dynamically on the frontend using `getChartIdsInFilterScope()`, which resolves the `scope` definition against the dashboard layout [[2]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardContainer.tsx#L168-L172). `tabsInScope` is then always derived from `chartsInScope` using `findTabsWithChartsInScope()` [[3]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/dashboard/components/nativeFilters/utils.ts#L163-L176). - **Not persisted**: These fields are excluded from dashboard exports and are regenerated from scratch when a dashboard loads. No backend database migrations exist for them — they live only in frontend React/Redux state [[4]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/packages/superset-ui-core/src/query/types/Dashboard.ts#L57-L81). - **Why they appear in 6.1.0**: They were introduced as a denormalized cache to support tab-aware filter visibility. PR #32196 added backend awareness for alert reports [[5]](https://github.com/apache/superset/pull/32196), PR #37139 updated the `useIsFilterInScope` hook to prioritize `chartsInScope` for determining filter visibility [[6]](https://github.com/apache/superset/pull/37139), and PR #40140 fixed import remapping for these fields [[7]](https://github.com/apache/superset/pull/40140). **For version-compatible processing logic**: You should treat `scope.rootPath` + `scope.excluded` as the stable contract. The `chartsInScope`/`tabsInScope` fields are an optimization for the frontend's runtime filter visibility logic. If you're seeing them in a YAML export from 6.1.0, that may indicate they're being inadvertently serialized in some code path — they are *supposed* to be stripped during export. This also ties back to the original issue you identified: since scope resolution now relies on these runtime-computed fields (via `useIsFilterInScope`), a broken layout tree where charts are missing proper `parents` chains means `chartsInScope` gets computed incorrectly during hydration, causing filters to silently fail to apply. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).* --- Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fsuperset). [](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=68e1b21a-c46b-4270-8175-7b5c5606a31a) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
