Skip to content

Commit

Permalink
vue/use-completion: fix: don't send network request for loading state (
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxLeiter committed Aug 26, 2023
1 parent 702a8f3 commit 8a2cbaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chilly-kangaroos-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'ai': patch
---

vue/use-completion: fix: don't send network request for loading state"
5 changes: 4 additions & 1 deletion packages/core/vue/use-completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ export function useCompletion({
)

const { data: isLoading, mutate: mutateLoading } = useSWRV<boolean>(
`${completionId}-loading`
`${completionId}-loading`,
null
)

isLoading.value ??= false

// Force the `data` to be `initialCompletion` if it's `undefined`.
data.value ||= initialCompletion

Expand Down

0 comments on commit 8a2cbaf

Please sign in to comment.