amaannawab923 commented on code in PR #33271:
URL: https://github.com/apache/superset/pull/33271#discussion_r2075208409


##########
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx:
##########
@@ -158,6 +166,30 @@ export default function PluginFilterSelect(props: 
PluginFilterSelectProps) {
       : filterState?.excludeFilterValues,
   );
 
+  const prevExcludeFilterValues = useRef(excludeFilterValues);
+
+  const hasOnlyOrientationChanged = useRef(false);
+
+  useEffect(() => {
+    // Get previous orientation for this specific filter
+    const previousOrientation = orientationMap.get(formData.nativeFilterId);

Review Comment:
   Doesnt work , this particular SelectFilterPlugin is having hard refresh & 
losing all of its values when used with refs , the approach used in this file 
uses a closure formed outside this component which is not deleted even on 
Complete remount
   
   As suggested i did try using usePrevious & the function ran on change of 
orientation of filter bar which isnt expected 
   
   Attatched are the screenshots when used usePrevious
   
   Orientation changed from Vertical to Horizontal with usePrevious : 
   
   <img width="1724" alt="Screenshot 2025-05-06 at 4 17 16 PM" 
src="https://github.com/user-attachments/assets/8c73e208-74a5-4aed-a51f-6f68da2183cb";
 />
   
   
   Orientation changed from  Horizontal  to vertical with usePrevious : 
   Now function ran count increased to 2
   <img width="1728" alt="Screenshot 2025-05-06 at 4 17 34 PM" 
src="https://github.com/user-attachments/assets/f8cc0f98-2370-49fe-933c-15edff2949ea";
 />
   
   
   



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