fix(MULTIPLA-009-3): CU-86akhf8u5 Inline query keys used for mingo-dialog and mingo-dialog-messages caches - #398
flamingo[bot] wants to merge 1 commit into
Conversation
…o-dialog-messages caches
| if (chunk.streamSeq < lastAppliedStreamSeqRef.current) return; | ||
| lastAppliedStreamSeqRef.current = chunk.streamSeq; | ||
| } | ||
| queryClient.setQueryData<DialogNode | null | undefined>(['mingo-dialog', dialogId], prev => |
There was a problem hiding this comment.
🦩 🟠 Inline query keys used for mingo-dialog and mingo-dialog-messages caches
In src/app/(app)/mingo/hooks/use-mingo-realtime-subscription.ts, replaced the inline ['mingo-dialog', dialogId] and ['mingo-dialog-messages', dialogId] literals (in syncStreamStateFromChunk's setQueryData call and in the reconnect invalidateQueries effect inside DialogSubscription) with two local key-builder functions, mingoDialogQueryKey and mingoDialogMessagesQueryKey, defined at module scope. This centralizes the key shape within the file so both call sites cannot silently diverge from each other. However, the finding asks for constants from a "centralized query-keys module" shared with the query hook that fetches mingo-dialog data; since that module/hook was not visible in the provided material, I could not verify its exact export name or import path, so I did not invent an import to it — a complete fix would require locating that hook's query-key definition and importing the shared constant from there instead of (or re-exporting) the local builders added here.
🤖 Prompt for AI agents
In src/app/(app)/mingo/hooks/use-mingo-realtime-subscription.ts around line 246, review and complete this code-review fix: Inline query keys used for mingo-dialog and mingo-dialog-messages caches.
What the draft fix changed: In `src/app/(app)/mingo/hooks/use-mingo-realtime-subscription.ts`, replaced the inline `['mingo-dialog', dialogId]` and `['mingo-dialog-messages', dialogId]` literals (in `syncStreamStateFromChunk`'s `setQueryData` call and in the reconnect `invalidateQueries` effect inside `DialogSubscription`) with two local key-builder functions, `mingoDialogQueryKey` and `mingoDialogMessagesQueryKey`, defined at module scope. This centralizes the key shape within the file so both call sites cannot silently diverge from each other. However, the finding asks for constants from a "centralized query-keys module" shared with the query hook that fetches `mingo-dialog` data; since that module/hook was not visible in the provided material, I could not verify its exact export name or import path, so I did not invent an import to it — a complete fix would require locating that hook's query-key definition and importing the shared constant from there instead of (or re-exporting) the local builders added here.
The fix is LOW CONFIDENCE — verify it is correct and finish whatever it left incomplete.
fix confidence: 🔴 55 low — review closely — react 👍/👎 to teach the reviewer
Closes findings from rule MULTIPLA-009-3 — Inline query keys used for mingo-dialog and mingo-dialog-messages caches.
Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.
src/app/(app)/mingo/hooks/use-mingo-realtime-subscription.ts:246What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.
Run: https://product-hub.flamingo.so/admin/code-review
Run id:
c69bf2d8-6eaa-4e2d-815b-af08b880c8dfMerging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.
ClickUp task: CU-86akhf8u5 OpenFrame OSS frontend review findings sweep (12 PRs)