GitHub user dosubot[bot] added a comment to the discussion: Reports Loads Data 
without Filters Applied

<!-- Answer -->
To prevent any data from loading until a filter is applied (not just setting a 
default filter), you need to configure your dashboard's native filters with 
these settings:

- Enable "Filter value is required" (this is the `enableEmptyFilter` option for 
Select filters).
- Disable "Select first filter value by default" (`defaultToFirstItem`).

With this setup, Superset will not load any data on dashboard or chart 
load—users must select a filter value before any queries run. If no value is 
selected, Superset injects a SQL filter like `1 = 0` to ensure no data is 
returned until the user interacts with the filter. This is different from 
setting a default filter value, which still triggers a query on load with that 
value applied ([see code 
reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/filters/components/Select/controlPanel.ts#L97-L124),
 [plugin 
logic](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx#L138-L390),
 [extra form data 
logic](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/filters/utils.ts#L33-L59)).

If you don't see these options in your UI (older Superset versions), you can 
manually set them in your dashboard's JSON metadata under 
`native_filter_configuration` 
([example](https://github.com/apache/superset/pull/30495)).

Known caveats: child filters in cascading setups do not auto-reset when a 
parent filter changes, and custom dashboard themes may cause filter application 
bugs, but these do not affect the core "no data until filter" logic 
([discussion](https://github.com/apache/superset/issues/37393#issuecomment-3825203741),
 [discussion](https://github.com/apache/superset/discussions/35245)).


<!-- 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/a80d4dc1-cee3-4fbc-be50-dec7960a48a4?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/a80d4dc1-cee3-4fbc-be50-dec7960a48a4?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/a80d4dc1-cee3-4fbc-be50-dec7960a48a4?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/a80d4dc1-cee3-4fbc-be50-dec7960a48a4?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/a80d4dc1-cee3-4fbc-be50-dec7960a48a4?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/a80d4dc1-cee3-4fbc-be50-dec7960a48a4?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/a80d4dc1-cee3-4fbc-be50-dec7960a48a4?feedback_type=other)</sup>

[![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=To%20prevent%20any%20data%20from%20loading%20until%20a%20filter%20is%20applied%20%28not%20just%20setting%20a%20default%20filter%29%2C%20you%20need%20to%20configure%20your%20dashboard%27s%20native%20filters%20with%20these%20settings%3A%0A%0A-%20Enable%20%22Filter%20value%20is%20required%22%20%28this%20is%20the%20%60enableEmptyFilter%60%20option%20for%20Select%20filters%29.%0A-%20Disable%20%22Select%20first%20filter%20value%20by%20default%22%20%28%60defaultToFirstItem%60%29.%0A%0AWith%20this%20setup%2C%20Superset%20will%20not%20load%20any%20data%20on%20dashboard%20or%20chart%20load%E2%80%94users%20must%20select%20a%20filter%20value%20before%20any%20queries%20run.%20If%20no%20value%20is%20selected%2C%20Superset%20injects%20a%20SQL%20filter%20like%20%601%
 
20%3D%200%60%20to%20ensure%20no%20data%20is%20returned%20until%20the%20user%20interacts%20with%20the%20filter.%20This%20is%20different%20from%20setting%20a%20default%20filter%20value%2C%20which%20still%20triggers%20a%20query%20on%20load%20with%20that%20value%20applied%C2%A0%28%5Bsee%20code%20reference%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/filters/components/Select/controlPanel.ts%23L97-L124%29%2C%20%5Bplugin%20logic%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx%23L138-L390%29%2C%20%5Bextra%20form%20data%20logic%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/filters/utils.ts%23L33-L59%29%29.%0A%0AIf%20you%20don%27t%20see%20these%20options%20in%20your%20UI%20%28older%20Superset%20versions%29%2C%20you%20can%20manually%20set%20them%20in%20your
 
%20dashboard%27s%20JSON%20metadata%20under%20%60native_filter_configuration%60%20%28%5Bexample%5D%28https%3A//github.com/apache/superset/pull/30495%29%29.%0A%0AKnown%20caveats%3A%20child%20filters%20in%20cascading%20setups%20do%20not%20auto-reset%20when%20a%20parent%20filter%20changes%2C%20and%20custom%20dashboard%20themes%20may%20cause%20filter%20application%20bugs%2C%20but%20these%20do%20not%20affect%20the%20core%20%22no%20data%20until%20filter%22%20logic%C2%A0%28%5Bdiscussion%5D%28https%3A//github.com/apache/superset/issues/37393%23issuecomment-3825203741%29%2C%20%5Bdiscussion%5D%28https%3A//github.com/apache/superset/discussions/35245%29%29.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![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/discussions/378
 34)

GitHub link: 
https://github.com/apache/superset/discussions/37834#discussioncomment-15754314

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to