Skip to content

Commit

Permalink
fix (ui): set status to ready after stream was aborted (#4897)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgrammel authored Feb 15, 2025
1 parent 3e6950f commit 60c3220
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/quick-apricots-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@ai-sdk/svelte': patch
'@ai-sdk/react': patch
'@ai-sdk/solid': patch
'@ai-sdk/vue': patch
---

fix (ui): set status to ready after stream was aborted
1 change: 1 addition & 0 deletions packages/react/src/use-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ By default, it's set to 1, which means that only a single LLM call is made.
// Ignore abort errors as they are expected.
if ((err as any).name === 'AbortError') {
abortControllerRef.current = null;
mutateStatus('ready');
return null;
}

Expand Down
1 change: 1 addition & 0 deletions packages/solid/src/use-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ export function useChat(
// Ignore abort errors as they are expected.
if ((err as any).name === 'AbortError') {
abortController = null;
setStatus('ready');
return null;
}

Expand Down
1 change: 1 addition & 0 deletions packages/svelte/src/use-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export function useChat({
// Ignore abort errors as they are expected.
if ((err as any).name === 'AbortError') {
abortController = null;
status.set('ready');
return null;
}

Expand Down
1 change: 1 addition & 0 deletions packages/vue/src/use-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ export function useChat(
// Ignore abort errors as they are expected.
if ((err as any).name === 'AbortError') {
abortController = null;
mutateStatus(() => 'ready');
return null;
}

Expand Down

0 comments on commit 60c3220

Please sign in to comment.