You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: handle newlines in SSE events to prevent content truncation
When HTML content contains newline characters (\n), the SSE event formatting
was not escaping them properly. This caused SSE events to be prematurely
terminated, resulting in truncated content on the client side during
live-reload updates.
Root cause: format-datastar-fragment was outputting HTML directly in a
single 'data: elements' line without handling newlines. Any \n\n in
the HTML would prematurely end the SSE event according to the SSE spec.
Fix: Split HTML by \n and emit multiple 'data: elements' lines, which
Datastar concatenates. This follows Datastar's documented multi-line
SSE format and prevents \n\n from breaking the event stream.
Tests added:
- Unit tests for textarea and pre elements with newline content
- E2E test for content with newlines during route redefinition
0 commit comments