dosubot[bot] commented on issue #37069: URL: https://github.com/apache/superset/issues/37069#issuecomment-3742022247
<!-- Answer --> In Superset 6.0, clicking "Clear All" only resets the filter values in the UI—it doesn't immediately update the visuals or charts. This is different from the behavior in PR #36882 for 5.x, where "Clear All" both cleared the filters and instantly applied the changes to the dashboard visuals by dispatching updateDataMask for each filter. In 6.0, the logic is split: "Clear All" updates local state, and you must click "Apply" to push those changes to the Redux store and trigger chart reloads. This separation is intentional and confirmed by maintainers—there's no built-in setting to make "Clear All" auto-apply changes out of the box ([source](https://github.com/apache/superset/issues/36876), [source](https://github.com/apache/superset/pull/35303)). If you want "Clear All" to immediately reset visuals, you can modify handleClearAll in the FilterBar component to dispatch updateDataMask for each cleared filter, just like handleApply does. Here’s a simplified example of how you might adapt your handleClearAll: ```js const handleClearAll = useCallback(() => { dispatch(logEvent(LOG_ACTIONS_CHANGE_DASHBOARD_FILTER, {})); setUpdateKey(1); const newClearAllTriggers = { ...clearAllTriggers }; const updates = {}; nativeFilterValues.forEach(filter => { const { id } = filter; if (dataMaskSelected[id]) { updates[id] = { ...dataMaskSelected[id], filterState: { ...dataMaskSelected[id].filterState, value: null, }, extraFormData: {}, }; newClearAllTriggers[id] = true; } }); setDataMaskSelected(draft => { Object.entries(updates).forEach(([id, mask]) => { draft[id] = mask; }); }); Object.entries(updates).forEach(([id, mask]) => { dispatch(updateDataMask(id, mask)); }); setClearAllTriggers(newClearAllTriggers); }, [dataMaskSelected, nativeFilterValues, setDataMaskSelected, clearAllTriggers, dispatch]); ``` This will clear the filters and immediately apply the changes, so the visuals reset without needing to click "Apply" ([reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx#L279-L305)). <!-- 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/11477877-ef7d-4b55-b9cb-80881af0a860?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/11477877-ef7d-4b55-b9cb-80881af0a860?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/11477877-ef7d-4b55-b9cb-80881af0a860?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/11477877-ef7d-4b55-b9cb-80881af0a860?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/11477877-ef7d-4b55-b9cb-80881af0a860?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/11477877-ef7d-4b55-b9cb-80881af0a860?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/11477877-ef7d-4b55-b9cb-80881af0a860?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=In%20Superset%206.0%2C%20clicking%20%22Clear%20All%22%20only%20resets%20the%20filter%20values%20in%20the%20UI%E2%80%94it%20doesn%27t%20immediately%20update%20the%20visuals%20or%20charts.%20This%20is%20different%20from%20the%20behavior%20in%20PR%20%2336882%20for%205.x%2C%20where%20%22Clear%20All%22%20both%20cleared%20the%20filters%20and%20instantly%20applied%20the%20changes%20to%20the%20dashboard%20visuals%20by%20dispatching%20updateDataMask%20for%20each%20filter.%0A%0AIn%206.0%2C%20the%20logic%20is%20split%3A%20%22Clear%20All%22%20updates%20local%20state%2C%20and%20you%20must%20click%20%22Apply%22%20to%20push%20those%20changes%20to%20the%20Redux%20store%20and%20trigger%20chart%20reloads.%20This%20separation%20is%20intentional%20and%20confirmed%20by %20maintainers%E2%80%94there%27s%20no%20built-in%20setting%20to%20make%20%22Clear%20All%22%20auto-apply%20changes%20out%20of%20the%20box%20%28%5Bsource%5D%28https%3A//github.com/apache/superset/issues/36876%29%2C%20%5Bsource%5D%28https%3A//github.com/apache/superset/pull/35303%29%29.%0A%0AIf%20you%20want%20%22Clear%20All%22%20to%20immediately%20reset%20visuals%2C%20you%20can%20modify%20handleClearAll%20in%20the%20FilterBar%20component%20to%20dispatch%20updateDataMask%20for%20each%20cleared%20filter%2C%20just%20like%20handleApply%20does.%20Here%E2%80%99s%20a%20simplified%20example%20of%20how%20you%20might%20adapt%20your%20handleClearAll%3A%0A%0A%60%60%60js%0Aconst%20handleClearAll%20%3D%20useCallback%28%28%29%20%3D%3E%20%7B%0A%20%20dispatch%28logEvent%28LOG_ACTIONS_CHANGE_DASHBOARD_FILTER%2C%20%7B%7D%29%29%3B%0A%20%20setUpdateKey%281%29%3B%0A%20%20const%20newClearAllTriggers%20%3D%20%7B%20...clearAllTriggers%20%7D%3B%0A%20%20const%20updates%20%3D%20%7B%7D%3B%0A%20%20nativeFilterValue s.forEach%28filter%20%3D%3E%20%7B%0A%20%20%20%20const%20%7B%20id%20%7D%20%3D%20filter%3B%0A%20%20%20%20if%20%28dataMaskSelected%5Bid%5D%29%20%7B%0A%20%20%20%20%20%20updates%5Bid%5D%20%3D%20%7B%0A%20%20%20%20%20%20%20%20...dataMaskSelected%5Bid%5D%2C%0A%20%20%20%20%20%20%20%20filterState%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20...dataMaskSelected%5Bid%5D.filterState%2C%0A%20%20%20%20%20%20%20%20%20%20value%3A%20null%2C%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20extraFormData%3A%20%7B%7D%2C%0A%20%20%20%20%20%20%7D%3B%0A%20%20%20%20%20%20newClearAllTriggers%5Bid%5D%20%3D%20true%3B%0A%20%20%20%20%7D%0A%20%20%7D%29%3B%0A%0A%20%20setDataMaskSelected%28draft%20%3D%3E%20%7B%0A%20%20%20%20Object.entries%28updates%29.forEach%28%28%5Bid%2C%20mask%5D%29%20%3D%3E%20%7B%0A%20%20%20%20%20%20draft%5Bid%5D%20%3D%20mask%3B%0A%20%20%20%20%7D%29%3B%0A%20%20%7D%29%3B%0A%0A%20%20Object.entries%28updates%29.forEach%28%28%5Bid%2C%20mask%5D%29%20%3D%3E%20%7B%0A%20%20%20%20dispatch%28updateD ataMask%28id%2C%20mask%29%29%3B%0A%20%20%7D%29%3B%0A%0A%20%20setClearAllTriggers%28newClearAllTriggers%29%3B%0A%7D%2C%20%5BdataMaskSelected%2C%20nativeFilterValues%2C%20setDataMaskSelected%2C%20clearAllTriggers%2C%20dispatch%5D%29%3B%0A%60%60%60%0A%0AThis%20will%20clear%20the%20filters%20and%20immediately%20apply%20the%20changes%2C%20so%20the%20visuals%20reset%20without%20needing%20to%20click%20%22Apply%22%20%28%5Breference%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx%23L279-L305%29%29.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/37069) -- 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]
