bito-code-review[bot] commented on PR #44880:
URL: https://github.com/apache/superset/pull/44880#issuecomment-5944044058

   <!-- Bito Reply -->
   The flagged issue is correct. The current implementation uses 
`useDeferredValue` to handle the `pendingLikeValue`, but when the operator type 
switches away from `LIKE`, the `deferredPendingLikeValue` may still hold the 
previous search text until it settles. Because the `useEffect` hook that 
triggers `updateDataMask` depends on `deferredPendingLikeValue`, it can 
re-trigger a data update with the old value even after the operator has changed.
   
   To resolve this, you should ensure the `useEffect` hook explicitly ignores 
updates when the operator is not `LIKE` or when the value is being reset. The 
current implementation already includes a check `!isLikeOperator` in the 
`useEffect` dependency, but it should be robust enough to handle the transition 
state. 
   
   If you are seeing this issue, ensure that the `useEffect` correctly cancels 
or ignores the effect when `isLikeOperator` changes. The current code already 
has `isLikeOperator` in the dependency array, which should trigger the effect 
to re-run when the operator changes. If the issue persists, it may be due to 
the `deferredPendingLikeValue` settling after the operator change. You can add 
a check to ensure the effect only runs if the operator is still `LIKE` at the 
time of execution.
   
   **superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx**
   ```
   useEffect(() => {
       if (
         deferredPendingLikeValue === null ||
         !isLikeOperator ||
         clearAllTrigger
       ) {
         return;
       }
       if (deferredPendingLikeValue) {
         updateDataMaskRef.current([deferredPendingLikeValue]);
       } else {
         updateDataMaskRef.current(null);
       }
     }, [deferredPendingLikeValue, isLikeOperator, clearAllTrigger]);
   ```


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