Vitor-Avila commented on PR #41214:
URL: https://github.com/apache/superset/pull/41214#issuecomment-4753578776

   > Thanks @Vitor-Avila, ths all seems sensible, but `unit-tests` ned some 
love. Those fixtures have `chartsInScope` but no `scope`/layout, so once we 
stop honoring `chartsInScope` the filter falls through to `"ROOT_ID" in []` and 
gets dropped. Is that just stale test data, or do real configs ever ship 
`chartsInScope` without a usable `scope.rootPath`? Want to make sure we're not 
silently dropping filters in the MCP path before this goes in.
   
   I think the concern here is very valid, @rusackas. My response to the bot 
comment might also be applicable here:
   
   > `chartsInScope` is a denormalized cache derived from scope 
[ref](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/util/calculateScopes.ts#L58-L62)
 (the type definition for `scope` is required, but for `chartsInScope` is 
optional 
[ref](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/src/query/types/Dashboard.ts#L67-L90)).
 That said, we should always have a `scope` value (the app can't produce 
`chartsInScope` without a `scope`).
   > 
   > The frontend does read `chartsInScope`, but it recomputes it from `scope` 
on every load before using it 
[ref](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardContainer.tsx#L203-L225),
 so `scope` is the real source of truth and the saved cache is never trusted 
as-is. The gap is that this recompute lives in memory and is only persisted on 
an explicit save, so the stored `chartsInScope` drifts stale while the UI stays 
correct.
   > 
   > With that in mind, computing from scope (what this PR does, mirroring 
`calculateScopes`/`getChartIdsInFilterScope`) is the backend equivalent of the 
frontend's recompute.
   
   


-- 
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]

Reply via email to