Ujjwaljain16 opened a new pull request, #38910:
URL: https://github.com/apache/superset/pull/38910
### SUMMARY
Dynamic native filter option queries currently go through
`/api/v1/chart/data`, which causes them to use `DATA_CACHE_CONFIG`. This leads
to stale dropdown values, especially in cases involving frequently changing
data or RLS.
This change introduces a minimal fix in
`QueryContextProcessor.get_cache_timeout()`:
* Detect native filter option queries via:
* `native_filter_id`
* `viz_type` starting with `filter_`
* absence of `metrics`
* Use `FILTER_STATE_CACHE_CONFIG["CACHE_DEFAULT_TIMEOUT"]` when available
* Fallback to existing `DATA_CACHE_CONFIG` behavior otherwise
This keeps the existing query and caching pipeline intact while aligning
cache TTL with filter semantics (high volatility, user-sensitive).
---
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (behavioral/backend fix)
---
### TESTING INSTRUCTIONS
1. Configure different cache timeouts:
* `DATA_CACHE_CONFIG["CACHE_DEFAULT_TIMEOUT"] = X`
* `FILTER_STATE_CACHE_CONFIG["CACHE_DEFAULT_TIMEOUT"] = Y`
2. Create a dashboard with a native filter using **dynamic filter values**
3. Trigger filter value loading:
* Verify that response `cache_timeout` equals `Y`
4. Verify non-filter queries:
* Use a regular chart request
* Confirm `cache_timeout` equals `X`
5. Remove `FILTER_STATE_CACHE_CONFIG["CACHE_DEFAULT_TIMEOUT"]`:
* Confirm filter queries fall back to `DATA_CACHE_CONFIG`
---
### ADDITIONAL INFORMATION
* [x] Has associated issue: Fixes #38219
* [ ] Required feature flags
* [ ] Changes UI
* [ ] Includes DB Migration
* [ ] Introduces new feature or API
* [ ] Removes existing feature or API
---
--
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]