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

   <!-- Bito Reply -->
   The flagged issue is correct: in browsers supporting BroadcastChannel, 
oauth2.html emits both a BroadcastChannel message and a storage event, causing 
both handlers to call handleOAuthComplete independently, leading to duplicate 
query re-runs/refreshes for the same tab_id.
   
   To resolve this minimally, add idempotency by tracking a handled flag per 
tab_id. I've implemented this by re-importing useRef, adding a ref to track 
handled tab_ids, and checking/setting it in handleOAuthComplete.
   
   No other comments found in the PR.
   
   **superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx**
   ```
   import { useEffect, useRef } from 'react';
   
   // ... existing code ...
   
   export function OAuth2RedirectMessage({
     // ... props ...
   }) {
     // ... existing code ...
     const handledTabIds = useRef(new Set<string>());
   
     // ... existing code ...
   
     const handleOAuthComplete = (tabId?: string) => {
       if (!tabId || handledTabIds.current.has(tabId)) {
         return;
       }
       handledTabIds.current.add(tabId);
       // ... rest of the function ...
     };
   
     // ... rest of the component ...
   }
   ```


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