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

   <!-- Bito Reply -->
   The flagged issue is correct. In the current implementation of 
`UserInfoModal.tsx`, the `catch` block handles the error by displaying a toast, 
but it does not prevent the `FormModal` from proceeding as if the operation 
were successful. Because the `catch` block resolves (it does not re-throw the 
error), the `FormModal` component likely interprets the completion of the 
`onSave` handler as a success, leading to the modal closing prematurely.
   
   To resolve this, you should ensure that the `onSave` callback is only 
invoked when the operation succeeds. You can achieve this by moving the 
`onSave()` call inside the `try` block after the successful API response, 
ensuring it is not reached if an error occurs.
   
   Would you like me to implement this fix for you, and would you like me to 
check and address the rest of the comments on this PR as well?
   
   **superset-frontend/src/features/userInfo/UserInfoModal.tsx**
   ```
   try {
         await SupersetClient.put({ ... });
         addSuccessToast(t('The user info update was successful'));
         onSave();
       } catch (response) {
         const { error } = await getClientErrorObject(response);
         addDangerToast(
           error || t('Something went wrong while saving the user info'),
         );
       }
   ```


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