Bug Description
When running EmbeddedChat and receiving typing status notifications over the DDP WebSocket connection, the browser tab completely freezes and becomes unresponsive (causing a white screen or canvas freeze in Storybook / React applications).
Root Cause Analysis
Inside packages/api/src/EmbeddedChatApi.ts, the function handleTypingEvent contains a synchronous busy-wait loop:
// packages/api/src/EmbeddedChatApi.ts (Line 456)
setTimeout(() => {
typingHandlerLock = 0;
}, 2000);
while (typingHandlerLock) {} // <--- Critical Bug
typingHandlerLock = 1;
Bug Description
When running EmbeddedChat and receiving typing status notifications over the DDP WebSocket connection, the browser tab completely freezes and becomes unresponsive (causing a white screen or canvas freeze in Storybook / React applications).
Root Cause Analysis
Inside
packages/api/src/EmbeddedChatApi.ts, the functionhandleTypingEventcontains a synchronous busy-wait loop: