codeant-ai-for-open-source[bot] commented on code in PR #43696:
URL: https://github.com/apache/superset/pull/43696#discussion_r3890465759
##########
superset-frontend/src/middleware/asyncEvent.ts:
##########
@@ -327,12 +323,18 @@ export const waitForAsyncData = async <T = unknown[]>(
): Promise<T> => {
const taskIds = asyncJob.task_ids ?? [];
+ // Capture the tab id once, in the same tick the 202 was received, and reuse
it
+ // for any later cancel/detach of these tasks. Reading it fresh at cancel
time
+ // could send a different id if the tab id was reassigned meanwhile (a
+ // duplicate-tab collision), orphaning the original per-tab subscription.
+ const submitTabId = getTabId();
Review Comment:
**Suggestion:** `submitTabId` is captured when the 202 response is handled,
not when the request subscribed the task, so tab reassignment before a delayed
response can make cancellation detach the wrong subscription. [stale reference]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=719f1e92a1d34a0c92729125e194b84c&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=719f1e92a1d34a0c92729125e194b84c&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/middleware/asyncEvent.ts
**Line:** 330:330
**Comment:**
*Stale Reference: `submitTabId` is captured when the 202 response is
handled, not when the request subscribed the task, so tab reassignment before a
delayed response can make cancellation detach the wrong subscription.
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%2F43696&comment_hash=e02d92b0a835162155fd581a736731497e008ce0a1ab1c4d593a1a00a15b5961&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43696&comment_hash=e02d92b0a835162155fd581a736731497e008ce0a1ab1c4d593a1a00a15b5961&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]