feat: Implement context menu for drill by#23454
Conversation
Codecov Report
@@ Coverage Diff @@
## master #23454 +/- ##
==========================================
- Coverage 67.65% 67.64% -0.01%
==========================================
Files 1910 1913 +3
Lines 73746 73838 +92
Branches 7987 8021 +34
==========================================
+ Hits 49891 49951 +60
- Misses 21814 21845 +31
- Partials 2041 2042 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
c7539e8 to
59587d0
Compare
de1c31f to
d793393
Compare
|
/testenv up FEATURE_DRILL_BY=true FEATURE_DRILL_TO_DETAIL=true FEATURE_DASHBOARD_CROSS_FILTERS=true |
|
@geido Ephemeral environment spinning up at http://54.191.91.221:8080. Credentials are |
villebro
left a comment
There was a problem hiding this comment.
LGTM and tested to work as expected, both with and without the FF. Since this is behind a FF I don't see any reason to not merge this as-is (if there are issues they will only affect users that have enabled the feature).
|
Ephemeral environment shutdown and build artifacts deleted. |
|
Found this PR researching why things that should be cached seemed to be cached ... Claude's analysis: Cache Architecture Analysis: PR #23454 Side EffectsSummaryPR #23454 introduced Original Implementation ContextCommit: Cache Implementation DetailsLocation: export const supersetGetCache = new Map<string, any>();
export const cachedSupersetGet = cacheWrapper(
SupersetClient.get,
supersetGetCache,
({ endpoint }) => endpoint || '',
);Design Characteristics:
Identified Issues1. Cache Invalidation GapProblem: Dataset metadata changes (like Affected Flow:
Current Invalidation: Only happens on API errors ( 2. Multi-User Data ConsistencyProblem: Client-side cache has no awareness of server-side data changes by other users. Scenario:
3. Cross-Component State SynchronizationProblem: Components that modify data don't coordinate with components that display cached versions of that data. Current Architecture: Missing: Cache invalidation bridge between data mutations and data consumers. Why This Wasn't a Problem InitiallyHistorical ContextOriginal drill-by scope: The cache was likely designed for read-only drill operations within a single session:
No data mutation: Original drill-by didn't involve editing dataset metadata during the session. SPA Navigation EvolutionPre-SPA behavior: Page refreshes between dataset editing and dashboard viewing would naturally clear caches. Current SPA behavior: React Router navigation preserves JavaScript state, exposing the cache staleness issue. Current Cache Usage AnalysisCache is used in 4 locations:
Cache invalidation: Only on errors, no systematic invalidation strategy. Recommended SolutionsShort-term (Current PR)Add cache invalidation to import { supersetGetCache } from 'src/utils/cachedSupersetGet';
// After successful dataset save:
const drillInfoEndpoint = `/api/v1/dataset/${currentDatasource.id}/drill_info/`;
supersetGetCache.delete(drillInfoEndpoint);Medium-term (Architecture Fix)Replace custom cache with proper cache management:
Long-term (Systematic Solution)Implement cache invalidation coordination:
Impact AssessmentPerformance Impact: The cache provides meaningful performance benefits for drill operations by avoiding repeated API calls. Data Consistency Impact: Cache staleness creates confusing UX where configuration changes don't take effect until hard refresh. Trade-off: Session performance vs. data freshness - current implementation prioritizes performance over consistency. ConclusionPR #23454's caching implementation represents a performance optimization that didn't account for data mutation scenarios. The cache works well for read-only operations but breaks down when dataset metadata becomes editable during the same session. This is a classic example of how performance optimizations can introduce subtle data consistency bugs that only manifest in specific user workflows involving cross-component data mutations. The issue is architectural rather than implementation-specific - any feature that modifies cached data will face similar staleness problems until systematic cache invalidation is implemented. |
SUMMARY
Charts that support drill by: all Echarts, World Map, Table, Pivot Table.
This PR implements right-click context menu with drill by option for charts that support the feature. When user right-click on series, the chart plugin constructs a filter object (similar to drill to detail filter), which in the result chart will be appended to original chart's adhoc filters. Then, user can select a column from drill by submenu that later will be used as a dimension of the result chart.
The columns are fetched when user opens the context menu. The result is cached, so that the request is not repeated for charts that use the same dataset. Only columns that are marked as dimensions in the dataset and are not used as dimensions of current chart can be selected.
If there are more than 10 available columns, a search input in the submenu is displayed.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION