dosubot[bot] commented on issue #40704: URL: https://github.com/apache/superset/issues/40704#issuecomment-4658357710
<!-- Answer --> Thanks for the root cause analysis and the YAML export — that's very helpful. Your diagnosis aligns well with what I can see in the code. **Why this breaks filter reapplication:** The [`useIsFilterInScope()` hook](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/dashboard/components/nativeFilters/state.ts#L100-L132) relies on each chart's `parents` array to determine filter scope. It calls `selectChartTabParents()` which [filters the `parents` array to find TAB-type ancestors](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/dashboard/components/nativeFilters/state.ts#L80-L98), then checks if those tab ancestors are all in `activeTabs`. If `GRID_ID` is empty and charts are missing it from their parents chain, the scope resolution tree is broken — the hook can't correctly determine which charts belong to which tabs, causing filters to fail silently on remount. **Why this would work initially but break after navigation:** On first load with user interaction, the filter state and tab state are built up together in Redux. But on remount (returning to the dashboard), `HYDRATE_DASHBOARD` reinitializes everything from the persisted position metadata. If that metadata has a broken tree (ROOT_ID → TABS directly, GRID_ID empty, charts missing GRID_ID from `parents`), the rehydrated scope resolution produces incorrect results. **Known related issues:** This pattern matches a [previously identified bug](https://github.com/apache/superset/pull/38409) where Superset dashboards with TABS placed directly under ROOT_ID caused charts to end up as invisible ghost entries under GRID_ID, because the search logic only checked `GRID_ID.children` for TABS components but missed TABS directly under ROOT_ID. There's also a [known issue](https://github.com/apache/superset/pull/37807) where the `parents` array wasn't updated properly after layout changes until dashboard save, leaving stale parent chains. **Regarding the layout inconsistency:** The [migration code](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2018-07-22_11-59_bebcf3fed1fe_convert_dashboard_v1_positions.py#L149-L162) establishes GRID_ID as a proper child of ROOT_ID with the correct parent chain, but if a dashboard was edited or copied during a version with the layout bug, the exported position JSON could persist in this broken state indefinitely since there's no runtime validation/repair of the `parents` arrays on load. A potential fix path could be: 1. A migration or runtime check during `HYDRATE_DASHBOARD` that rebuilds `parents` arrays from the actual `children` relationships (similar to `updateComponentParentsList` which already exists but is only called on save/edit) 2. Or a targeted fix ensuring `updateComponentParentsList` runs during hydration before scope resolution executes Would you be interested in submitting a PR for this? The `updateComponentParentsList` function already has the logic to rebuild parent chains — it may just need to be invoked during the hydration flow. <!-- 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=4e238b99-526b-4be1-bdaa-924eba6c2d04) [](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]
