Skip to content

Fix TaskModal lint failure by removing synchronous state update in effect - #1

Closed
Ishaan2510 with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-failing-github-actions-job-lint
Closed

Fix TaskModal lint failure by removing synchronous state update in effect#1
Ishaan2510 with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-failing-github-actions-job-lint

Conversation

Copilot AI commented Aug 4, 2026

Copy link
Copy Markdown

The lint GitHub Actions job failed due to react-hooks/set-state-in-effect in TaskModal.jsx, where component state was being synchronously set inside an effect. This change removes that anti-pattern while preserving task-stream initialization behavior.

  • Root cause addressed: TaskModal effect state sync

    • Reworked TaskModal task-state initialization so it no longer calls setDetail(task) directly in the useEffect body that opens the EventSource stream.
    • Kept existing stream lifecycle behavior (snapshot, progress, token, provider_switch, complete, error) intact.
  • State flow cleanup

    • detail now derives from the current task input/state transition pattern instead of being force-set synchronously at effect start.
    • Reset logic for transient streaming state (streamingResult, provider-switch banner, token buffer) remains coupled to task changes.
useEffect(() => {
  if (!task) return;

  // removed synchronous setDetail(task) here
  setStreaming('');
  setSwitch(null);
  tokenBufferRef.current = '';

  const es = new EventSource(`${API_BASE}/api/tasks/${task._id}/stream`, { withCredentials: true });
  // ...existing stream event handling...
}, [task]);

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cortex Ready Ready Preview Aug 4, 2026 3:44pm

Copilot AI changed the title [WIP] Fix failing GitHub Actions job lint Fix TaskModal lint failure by removing synchronous state update in effect Aug 4, 2026
Copilot AI requested a review from Ishaan2510 August 4, 2026 15:46
@Ishaan2510 Ishaan2510 closed this Aug 4, 2026
@Ishaan2510
Ishaan2510 deleted the copilot/fix-failing-github-actions-job-lint branch August 4, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants