diff --git a/vibn-frontend/app/api/projects/[projectId]/stream/route.ts b/vibn-frontend/app/api/projects/[projectId]/stream/route.ts index 0c321755..5d3ba165 100644 --- a/vibn-frontend/app/api/projects/[projectId]/stream/route.ts +++ b/vibn-frontend/app/api/projects/[projectId]/stream/route.ts @@ -72,6 +72,7 @@ export async function GET( "Content-Type": "text/event-stream", "Cache-Control": "no-cache, no-transform", Connection: "keep-alive", + "X-Accel-Buffering": "no", }, }); } diff --git a/vibn-frontend/components/vibn-chat/chat-panel.tsx b/vibn-frontend/components/vibn-chat/chat-panel.tsx index f0508216..0024d793 100644 --- a/vibn-frontend/components/vibn-chat/chat-panel.tsx +++ b/vibn-frontend/components/vibn-chat/chat-panel.tsx @@ -2025,8 +2025,13 @@ export function ChatPanel({ }} onInput={(e) => { const el = e.currentTarget; - el.style.height = "auto"; - el.style.height = Math.min(el.scrollHeight, 120) + "px"; + const newlines = (el.value.match(/\n/g) || []).length; + // Cache lastNewlines on the DOM element to avoid state re-render lag + if ((el as any).lastNewlines !== newlines) { + (el as any).lastNewlines = newlines; + el.style.height = "auto"; + el.style.height = Math.min(el.scrollHeight, 120) + "px"; + } }} /> {selectToggle}