fix: address code review findings for AI chat builder

- C1: Fix race condition in handleReset — await abandonSession before
  starting new session to prevent store state corruption
- I1: Extract error messages from Axios response.data.detail instead of
  generic error.message — users now see helpful backend messages (quota
  limits, message caps, etc.)
- I2: Add isGenerating guard in generateTree store action to prevent
  concurrent generation requests on double-click
- I3: Add isResponding guard in sendMessage to prevent concurrent sends
- M5: Remove redundant type casts on flowType
- M6: Add rate limiter to DELETE /sessions/{id} for consistency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-02-27 08:53:54 -05:00
parent 596153085a
commit e79ffff1dc
3 changed files with 24 additions and 16 deletions

View File

@@ -417,7 +417,9 @@ async def import_tree(
@router.delete("/sessions/{session_id}", status_code=204)
@limiter.limit("10/minute")
async def abandon_session(
request: Request,
session_id: UUID,
current_user: Annotated[User, Depends(get_current_active_user)],
db: Annotated[AsyncSession, Depends(get_db)],