mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Replace 5 independent useState calls (clineAsk, enableButtons, sendingDisabled, primaryButtonText, secondaryButtonText) with a single useReducer to eliminate partial-update race windows. The race condition: when an api_req_started message clears state via 5 separate setState calls, React can render between updates, leaving clineAsk as undefined while button text still shows 'Start New Task'. Clicks during this window are silently swallowed. With useReducer, all 5 fields update atomically in a single dispatch, making the race structurally impossible. Also preserves the fix for stale isStreaming on secondary button clicks: api_req_failed/mistake_limit_reached/resume_task cases are checked before the isStreaming guard in handleSecondaryButtonClick. 4 action types: - SET_ASK_STATE: atomic update of all 5 fields - SET_SENDING_DISABLED: partial update for retry delay/condensing - SET_BUTTON_TEXT: partial update for subtask resume - RESET_WITHOUT_BUTTON_TEXT: resets without clearing button text Tests: 26/26 pass, tsc clean, lint clean |
||
|---|---|---|
| .. | ||
| audio | ||
| public | ||
| src | ||
| .gitignore | ||
| components.json | ||
| eslint.config.mjs | ||
| index.html | ||
| package.json | ||
| tsconfig.json | ||
| turbo.json | ||
| vite.config.ts | ||
| vitest.config.ts | ||
| vitest.setup.ts | ||