FrancescoCastaldi commented on code in PR #45051:
URL: https://github.com/apache/superset/pull/45051#discussion_r4217173504


##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControls.tsx:
##########
@@ -671,7 +670,6 @@ const FilterControls: FC<FilterControlsProps> = ({
                 }
               : undefined
           }
-          forceRender={hasRequiredFirst}
           ref={popoverRef}

Review Comment:
   Thanks @sadpandajoe, that is a great observation.
   
   We decoupled required-first filter initialization from popover visibility 
directly in `FilterValue.tsx`:
   
   ```tsx
   const isRequiredFirst =
     filter.requiredFirst === true && filter.filterType !== 'filter_time';
   const [inViewFirstTime, setInViewFirstTime] = useState(
     inView || isRequiredFirst,
   );
   ```
   
   When `isRequiredFirst` is true, `FilterValue` bypasses the `inView` 
visibility gate on initial mount, fetching its options and auto-selecting the 
first value immediately without waiting for an `OutPortal` or an open popover 
to set `inView: true`. This addresses #24542 at the source and ensures 
out-of-scope/overflow filters initialize their default selection without 
needing `forceRender` on the popover.
   
   We also added a unit test in `FilterValue.test.tsx` (`fetches data when 
inView is false if filter has requiredFirst`) to ensure this behavior remains 
covered.



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