ui: Linting & Formatting scripts (#26819)

This commit is contained in:
Aleksander Grygier
2026-08-10 08:38:37 +02:00
committed by GitHub
parent 1e396e72a8
commit 92d1bb0c99
538 changed files with 8806 additions and 6036 deletions
+9
View File
@@ -30,9 +30,11 @@ export async function* parseSseJsonStream<T = unknown>(
signal?: AbortSignal
): AsyncGenerator<SseJsonEvent<T>> {
const reader = response.body?.getReader();
if (!reader) return;
const decoder = new TextDecoder();
let buffer = '';
try {
@@ -40,19 +42,26 @@ export async function* parseSseJsonStream<T = unknown>(
if (signal?.aborted) return;
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const records = buffer.split(SSE_RECORD_SEPARATOR);
buffer = records.pop() ?? '';
for (const record of records) {
if (!record) continue;
for (const line of record.split(SSE_LINE_SEPARATOR)) {
if (!line.startsWith(SSE_DATA_PREFIX)) continue;
const payload = line.slice(SSE_DATA_PREFIX.length).trim();
if (payload === SSE_DONE_MARKER) return;
if (!payload) continue;
try {
yield { data: JSON.parse(payload) as T };
} catch {