Skip to content

Commit ae690da

Browse files
authored
fix: now missing errors reported render in the UI (#116)
Now missing errors reported render in the UI. Fixes #112 ![CleanShot 2025-07-07 at 19 15 00@2x](https://github.com/user-attachments/assets/2867c1ea-8a2c-4603-b3f6-52d5601b19b0)
1 parent 2e30eb7 commit ae690da

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/components/Chat.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -270,18 +270,25 @@ export function Chat() {
270270
// Handle error messages
271271
try {
272272
const errorData = JSON.parse(line.slice(2))
273-
pendingStreamEventsRef.current.push({
274-
type: 'error',
275-
message:
276-
errorData.message || 'An error occurred during streaming',
277-
details: errorData.details,
278-
})
273+
// Process error events immediately instead of buffering
274+
setStreamBuffer((prev) => [
275+
...prev,
276+
{
277+
type: 'error',
278+
message:
279+
errorData.message || 'An error occurred during streaming',
280+
details: errorData.details,
281+
},
282+
])
279283
} catch (e) {
280284
console.error('Failed to parse error data:', e)
281-
pendingStreamEventsRef.current.push({
282-
type: 'error',
283-
message: 'An unknown error occurred during streaming',
284-
})
285+
setStreamBuffer((prev) => [
286+
...prev,
287+
{
288+
type: 'error',
289+
message: 'An unknown error occurred during streaming',
290+
},
291+
])
285292
}
286293
return
287294
}

0 commit comments

Comments
 (0)