Bug description
The "view as table" view does not update it's content past the first interaction, when the same query is used (including filter options, like time range), within the caching window when caching is enabled. Whilst the graphs/slices seem to use the cache accordingly and update their content on dashboard refreshes, the "view as table" option does not.
How to reproduce the bug
Enabled cahing in superset_config.py.
I have the following cache settings enabled:
DATA_CACHE_CONFIG = {
'CACHE_TYPE: 'SimpleCache',
'CACHE_DEFAULT_TIMEOUT': 60*60*24,
'CACHE_THRESHOLD': 10000,
}
Go to a dashboard and select "view as table" on a graph/slice.
Close the "view as table" pop up.
Wait until the dashboard has been refreshed, or force refresh it yourself, and until new data has been received for the relevant graph/slice.
Without changing the query (including filter options), select "view as table" on the same graph/slice as before.
The presented data should by the same as the first time "view as table" was viewed.
Screenshots/recordings
First interaction with "view as table" in caching window:
Second interaction with "view as table" in caching window on same graph after dashboard refresh with new data:
Superset version
4.0.1
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
- [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Comment From: dosubot[bot]
It looks like the issue with the "view as table" feature not updating correctly in Superset might be related to how the feature interacts with the caching mechanism and how component updates are managed. Here are some targeted steps to troubleshoot and potentially resolve the issue:
-
Ensure Proper Triggering of Refresh: Check that the
forceRefresh
method is correctly invoked to force a refresh of the chart. This method should be called with the appropriate parameters to ensure the table content is updated. -
Verify Chart Container Updates: Make sure the
ChartContainer
component, which renders the chart content including the "view as table" option, receives updated props that trigger a re-render when new data is available. -
Check for Prop Changes: In the
Chart
component, ensure that theshouldComponentUpdate
method correctly identifies changes in data that should trigger a table update. This may involve adding logic to detect changes toqueriesResponse
or related data props. -
Debugging and Logging: Utilize logging to debug and track when refreshes are requested and when data is expected to update. This can help identify if the issue lies in not triggering updates or if updates are triggered but not reflected in the UI.
-
Review Caching Logic: Review how caching is handled for the "view as table" data, especially ensuring that the cache is correctly invalidated or bypassed on a forced refresh.
If following these steps does not resolve the issue, it might be indicative of a bug in the Superset codebase, which could warrant further investigation or reporting as a new issue.
#### Details
**Sources** - [superset-frontend/src/dashboard/components/gridComponents/Chart.jsx](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx) - [superset/common/query_actions.py](https://github.com/apache/superset/blob/master/superset/common/query_actions.py) - [superset/common/utils/query_cache_manager.py](https://github.com/apache/superset/blob/master/superset/common/utils/query_cache_manager.py) - [superset/config.py](https://github.com/apache/superset/blob/master/superset/config.py) - [superset/viz.py](https://github.com/apache/superset/blob/master/superset/viz.py) - [superset-frontend/src/components/Chart/ChartRenderer.jsx](https://github.com/apache/superset/blob/master/superset-frontend/src/components/Chart/ChartRenderer.jsx) - [superset/utils/cache.py](https://github.com/apache/superset/blob/master/superset/utils/cache.py) - [tests/integration_tests/cachekeys/api_tests.py](https://github.com/apache/superset/blob/master/tests/integration_tests/cachekeys/api_tests.py) - [superset/common/query_context_processor.py](https://github.com/apache/superset/blob/master/superset/common/query_context_processor.py)**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
Comment From: rusackas
Is this still the case in 4.1.1 or 5.0.0rc1? Was tempted to close this as stale, but if it still exists, it just seems to be a bit of an edge case. Without more reports/support it's unlikely to get prioritized, so we'd welcome a fix contribution!
Comment From: rusackas
Closing as inactive, but happy to revisit/reopen if it's still an issue in newer versions!