krmmkr commented on code in PR #44216:
URL: https://github.com/apache/superset/pull/44216#discussion_r4022076890


##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/useFilterControlFactory.tsx:
##########
@@ -37,9 +43,28 @@ export const useFilterControlFactory = (
   onClearAllComplete?: (filterId: string) => void,
 ) => {
   const filters = useFilters();
+  const dashboardLayout = useSelector<RootState, DashboardLayout>(
+    state => state.dashboardLayout?.present || {},
+  );
+
+  const canvasFilterIds = useMemo(() => {
+    const ids = new Set<string>();
+    Object.values(dashboardLayout).forEach(item => {
+      const filterId =
+        item?.type === FILTER_TYPE ? String(item?.meta?.filterId || '') : '';
+      if (filterId && filterId in filters) {
+        ids.add(filterId);
+      }
+    });
+    return ids;
+  }, [dashboardLayout, filters]);
+
   const filterValues = useMemo(
-    () => Object.values(filters) as (Filter | Divider)[],
-    [filters],
+    () =>
+      (Object.values(filters) as (Filter | Divider)[]).filter(
+        filter => isFilterDivider(filter) || !canvasFilterIds.has(filter.id),

Review Comment:
   Thanks for the feedback. updated useFilterControlFactory so canvas-bound 
requiredFirst filters remain mounted until their initial data mask value is 
seeded, preventing the DashboardBuilder deadlock on cold reload. Once 
initialized, they are excluded from the bar as intended. Added unit test 
coverage in useFilterControlFactory.test.tsx.



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