codeant-ai-for-open-source[bot] commented on code in PR #43701:
URL: https://github.com/apache/superset/pull/43701#discussion_r3891616501
##########
superset-frontend/src/views/CRUD/hooks.ts:
##########
@@ -339,10 +339,14 @@ export function useListViewResource<D extends object =
any>(
},
);
- // Nudges are lossy and not replayed, so on a socket (re)connect refetch
the
- // currently-displayed rows once to reconcile anything missed while the
socket
- // was down. In-place merge, no full-list redraw.
- const unsubscribeOpen = subscribeRealtimeOpen(() => {
+ // Nudges are lossy and not replayed, so after recovering from a dropped
+ // socket refetch the currently-displayed rows once to reconcile anything
+ // missed while disconnected. Only on a real `reconnect` โ not the initial
+ // connect (rows were just fetched) or a seamless `keepalive` token
refresh โ
+ // so a healthy socket doesn't trigger a full re-fetch every keepalive
cycle.
+ // In-place merge, no full-list redraw.
+ const unsubscribeOpen = subscribeRealtimeOpen(reason => {
+ if (reason !== 'reconnect') return;
patchRows(collectionRef.current.map(rowId));
Review Comment:
**Suggestion:** `patchRows` runs outside `latestRequestIdRef`; its delayed
response can merge an older reconnect snapshot after a newer page, filter, or
refresh request completes. [race condition]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=9001c57a4818480d87749ac5e3b8e8d7&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=9001c57a4818480d87749ac5e3b8e8d7&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/views/CRUD/hooks.ts
**Line:** 350:350
**Comment:**
*Race Condition: `patchRows` runs outside `latestRequestIdRef`; its
delayed response can merge an older reconnect snapshot after a newer page,
filter, or refresh request completes.
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%2F43701&comment_hash=f1c80d5d69f5e20f4576b4ebe1d00902f420120631ee5fac293b981cff5c56ca&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43701&comment_hash=f1c80d5d69f5e20f4576b4ebe1d00902f420120631ee5fac293b981cff5c56ca&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]