mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
style(frontend): remove eslint-disable by referencing rawMessages in effect body
Reference rawMessages.length in the stream timeout effect so the exhaustive-deps rule is satisfied without an eslint suppressor comment.
This commit is contained in:
@@ -486,6 +486,11 @@ export function useCopilotStream({
|
||||
// indefinitely (e.g. when the SSE connection dies silently without a
|
||||
// disconnect event).
|
||||
useEffect(() => {
|
||||
// rawMessages is intentionally in the dependency array: each SSE event
|
||||
// updates rawMessages, which re-runs this effect and resets the timer.
|
||||
// Referencing its length here satisfies the exhaustive-deps rule.
|
||||
void rawMessages.length;
|
||||
|
||||
const isActive = status === "streaming" || status === "submitted";
|
||||
if (!isActive) {
|
||||
clearTimeout(streamTimeoutRef.current);
|
||||
@@ -509,8 +514,6 @@ export function useCopilotStream({
|
||||
clearTimeout(streamTimeoutRef.current);
|
||||
streamTimeoutRef.current = undefined;
|
||||
};
|
||||
// rawMessages changes on every SSE event, resetting the timeout.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [status, rawMessages]);
|
||||
|
||||
// True while reconnecting or backend has active stream but we haven't connected yet.
|
||||
|
||||
Reference in New Issue
Block a user