* fix: improve "Ask Agent to Fix" button UX and remove outdated TODO
Replaced browser alerts with proper visual feedback:
- Added loading state ("Sending...") with disabled button during request
- Show success state ("Sent!") in green for 3 seconds
- Show error state ("Failed") in red for 3 seconds
- Prevent multiple clicks while processing
Also removed outdated TODO comment - the API endpoint is already implemented.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix: prevent race condition in concurrent "Ask Agent to Fix" clicks
Changed state tracking from single values to Sets to properly handle
multiple concurrent button clicks:
- `sendingComments: Set<string>` - tracks all in-flight requests
- `sentComments: Set<string>` - tracks successful completions
- `errorComments: Set<string>` - tracks failures
- `timersRef: Map<string, Timeout>` - per-comment cleanup timers
This ensures that:
- Each button correctly shows its own loading/success/error state
- Buttons remain disabled only while their specific request is pending
- Callbacks from different requests don't overwrite each other's state
Fixes the race condition identified by Cursor Bugbot.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| e2e | ||
| screenshots | ||
| server | ||
| src | ||
| .env.local.example | ||
| .gitignore | ||
| next-env.d.ts | ||
| next.config.js | ||
| package.json | ||
| postcss.config.mjs | ||
| tsconfig.json | ||
| vitest.config.ts | ||