dosubot[bot] commented on issue #24511: URL: https://github.com/apache/superset/issues/24511#issuecomment-2957581423
<!-- Answer --> This dependent filter issue is well-documented and still present in recent Superset versions. The core problem is that when a parent filter changes, the dependent filter's selected value isn't cleared if it no longer exists in the updated options. The frontend logic for native filters uses `cascadeParentIds` and merges parent filter state, but it doesn't automatically clear invalid selections in the child filter when the parent's options change. This can result in stale or invalid filter states, especially with async data loading or when using "Select first filter value by default"—leading to "null" or mismatched values in child filters. There are no merged PRs or official fixes for this yet, but the relevant logic lives in the frontend, especially in the `useFilterDependencies` hook and the `FilterValue` and `PluginFilterSelect` components. The system is designed to recalculate options, but it doesn't enforce clearing the selection if the value is no longer valid. Some related logic for clearing invalid choices exists in the Explore view (`handleMissingChoice`), but not in the dashboard/native filter system. A robust fix would likely involve updating the dependent filter's state to clear or reset its value whenever its options change and the current selection is no longer valid. This would need to be handled in the filter state management and/or the `FilterValue` component, possibly by comparing the current selection to the new options after each parent filter update. For now, there are no documented workarounds other than manually clearing the child filter after changing the parent. For more technical details, see the relevant code and discussions: - [Filter dependencies and state management](https://github.com/apache/superset/blob/86e7139245e7444e749b5e8ad1d5167b4df53ce9/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/state.ts) - [FilterValue component logic](https://github.com/apache/superset/blob/86e7139245e7444e749b5e8ad1d5167b4df53ce9/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx) - [Related issue on filter clearing and required filters](https://github.com/apache/superset/issues/33361) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/878d4f93-5e48-4a70-870c-44a3eee5682b?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/878d4f93-5e48-4a70-870c-44a3eee5682b?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/878d4f93-5e48-4a70-870c-44a3eee5682b?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/878d4f93-5e48-4a70-870c-44a3eee5682b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/878d4f93-5e48-4a70-870c-44a3eee5682b?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/878d4f93-5e48-4a70-870c-44a3eee5682b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/878d4f93-5e48-4a70-870c-44a3eee5682b?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [! [Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/24511) -- 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]
