Guard empty/whitespace chat messages on the frontend #51

Closed
opened 2026-07-28 05:07:25 -07:00 by westfarn · 0 comments
Owner

Problem

Idle browser tabs (including mobile viewport) keep a WebSocket open and send keepalive { "type": "ping" } frames. Combined with backend treating empty payloads as new chats (see chat_backend#31), this spawned rogue conversations in prod.

Frontend form validation already requires prompt text, but whitespace-only input could still slip through, and sendMessage did not reject empty text.

Expected

  • Yup validation trims prompt text (whitespace-only fails)
  • Submit handlers and sendMessage refuse empty/whitespace messages
  • Tests cover empty sendMessage rejection

Related

## Problem Idle browser tabs (including mobile viewport) keep a WebSocket open and send keepalive `{ "type": "ping" }` frames. Combined with backend treating empty payloads as new chats (see chat_backend#31), this spawned rogue conversations in prod. Frontend form validation already requires prompt text, but whitespace-only input could still slip through, and `sendMessage` did not reject empty text. ## Expected - Yup validation trims prompt text (whitespace-only fails) - Submit handlers and `sendMessage` refuse empty/whitespace messages - Tests cover empty `sendMessage` rejection ## Related - Backend fix: https://git.aimloperations.com/ai_ml_operations/chat_backend/issues/31
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_web_app#51