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

   <!-- Bito Reply -->
   The flagged issue is correct. Because the `position` state is initialized 
inside `CustomModal` and not reset when the modal closes, the modal retains its 
previous drag offset when reopened. To resolve this, you should reset the 
`position` state to `{ x: 0, y: 0 }` whenever the `show` prop transitions to 
`false` or when the modal is opened.
   
   You can implement this by adding a `useEffect` hook in `CustomModal` that 
monitors the `show` prop:
   
   ```tsx
   useEffect(() => {
     if (!show) {
       setPosition({ x: 0, y: 0 });
     }
   }, [show]);
   ```
   
   Would you like me to check the other comments on this PR and implement fixes 
for them as well?
   
   
**superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.tsx**
   ```
   useEffect(() => {
       if (!show) {
         setPosition({ x: 0, y: 0 });
       }
     }, [show]);
   ```


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