suddjian commented on a change in pull request #15063:
URL: https://github.com/apache/superset/pull/15063#discussion_r648761375



##########
File path: 
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControls.tsx
##########
@@ -80,11 +80,31 @@ const FilterControls: FC<FilterControlsProps> = ({
     element => element.type === TAB_TYPE,
   );
   const showCollapsePanel = dashboardHasTabs && cascadeFilters.length > 0;
-  if (!lastFocusedTabId || !dashboardHasTabs) {
+
+  // we check native filters scopes only on dashboards with tabs
+  if (!dashboardHasTabs) {
     filtersInScope = cascadeFilters;
   } else {
     cascadeFilters.forEach((filter, index) => {
-      if (cascadeFilters[index].tabsInScope?.includes(lastFocusedTabId)) {
+      // Filter is in scope if any of it's charts is visible.
+      // Chart is visible if it's placed in an active tab tree or if it's not 
attached to any tab.
+      // Chart is in an active tab tree if all of it's ancestors of type TAB 
are active
+      const isFilterInScope = cascadeFilters[index].chartsInScope?.some(

Review comment:
       ```suggestion
         const isFilterInScope = filter.chartsInScope?.some(
   ```




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

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