codeant-ai-for-open-source[bot] commented on code in PR #42581:
URL: https://github.com/apache/superset/pull/42581#discussion_r3679964570
##########
superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx:
##########
@@ -103,13 +104,18 @@ export function OAuth2RedirectMessage({
);
const dispatch = useDispatch();
+ const lastHandledTabIdRef = useRef<string>();
useEffect(() => {
const handleOAuthComplete = (tabId?: string) => {
- if (tabId !== extra.tab_id) {
+ if (tabId !== extra.tab_id || tabId === lastHandledTabIdRef.current) {
return;
}
- if (source === 'sqllab' && query) {
+ lastHandledTabIdRef.current = tabId;
+
+ if (errorMitigationFunction) {
+ errorMitigationFunction();
+ } else if (source === 'sqllab' && query) {
dispatch(reRunQuery(query));
Review Comment:
**Suggestion:** The tab ID is marked as handled before confirming that any
mitigation or rerun can actually execute. For SQL Lab, `query` can be
temporarily unavailable when the OAuth completion arrives; the event is then
consumed without dispatching `reRunQuery`, and the matching
BroadcastChannel/storage duplicate is suppressed as well. If the query becomes
available afterward, the component never retries. Record the tab ID only after
a valid action is scheduled, or otherwise retry when the required state becomes
available. [logic error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ SQL Lab OAuth completion may not rerun the failed query.
- ⚠️ Users must manually rerun after authorization.
- ⚠️ BroadcastChannel and storage retries are both suppressed.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=d998bb84f5d14956be9dbb0834ebcedf&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=d998bb84f5d14956be9dbb0834ebcedf&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx
**Line:** 111:119
**Comment:**
*Logic Error: The tab ID is marked as handled before confirming that
any mitigation or rerun can actually execute. For SQL Lab, `query` can be
temporarily unavailable when the OAuth completion arrives; the event is then
consumed without dispatching `reRunQuery`, and the matching
BroadcastChannel/storage duplicate is suppressed as well. If the query becomes
available afterward, the component never retries. Record the tab ID only after
a valid action is scheduled, or otherwise retry when the required state becomes
available.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42581&comment_hash=a89d0094c93b515d48b8956b10a6a59c31a62a34b61d9c60a1b2135d7728e637&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42581&comment_hash=a89d0094c93b515d48b8956b10a6a59c31a62a34b61d9c60a1b2135d7728e637&reaction=dislike'>👎</a>
--
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]