codeant-ai-for-open-source[bot] commented on code in PR #43436:
URL: https://github.com/apache/superset/pull/43436#discussion_r3839263222
##########
superset-frontend/src/middleware/asyncEvent.ts:
##########
@@ -310,21 +257,22 @@ export const waitForAsyncData = async <T = unknown[]>(
export const init = (appConfig?: AppConfig) => {
pollingGeneration += 1;
if (pollingTimeoutId) clearTimeout(pollingTimeoutId);
- teardownWebSocket();
+
+ config = appConfig || getBootstrapData().common.conf;
+
+ // (Re)connect the shared realtime socket whenever the websocket transport is
+ // enabled โ independent of GLOBAL_ASYNC_QUERIES, since realtime list views
+ // (tier-1 entity-change nudges) ride the same socket. Idempotent: a no-op
when
+ // WEBSOCKET_ENABLED is false, and supersedes any prior socket otherwise.
+ connectRealtime(config);
Review Comment:
**Suggestion:** When `GlobalAsyncQueries` is disabled, `waitersByTaskId` is
never initialized because the function returns after this connection call.
However, the newly connected socket still delivers `realtime:*` messages to
`handleRealtimeMessage`, which calls `applyStatus` and dereferences
`waitersByTaskId` with `.get`, causing a `TypeError` for every terminal task
message. Initialize the waiter map before the feature-flag return or guard
realtime status handling when async queries are disabled. [null pointer]
<details>
<summary><b>Severity Level:</b> Minor ๐งน</summary>
```mdx
- โ ๏ธ Realtime chart-task messages generate repeated handler errors.
- โ ๏ธ Async completion handling cannot process messages in this state.
- โ ๏ธ Errors are swallowed by the shared realtime dispatcher.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
<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:** 267:267
**Comment:**
*Null Pointer: When `GlobalAsyncQueries` is disabled, `waitersByTaskId`
is never initialized because the function returns after this connection call.
However, the newly connected socket still delivers `realtime:*` messages to
`handleRealtimeMessage`, which calls `applyStatus` and dereferences
`waitersByTaskId` with `.get`, causing a `TypeError` for every terminal task
message. Initialize the waiter map before the feature-flag return or guard
realtime status handling when async queries are disabled.
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%2F43436&comment_hash=b705794d2930d44a10d1e2bcc4bb3606199c2a8116b7f529cd87fcace3c9a36b&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43436&comment_hash=b705794d2930d44a10d1e2bcc4bb3606199c2a8116b7f529cd87fcace3c9a36b&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]