-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(query): query refresh on defineQuery output composable call
- Loading branch information
1 parent
9da9d2c
commit 28a3ec1
Showing
4 changed files
with
37 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { defineQuery, useQuery } from '@pinia/colada' | ||
import { useRouteQuery } from '@vueuse/router' | ||
import { searchContacts } from '@/api/contacts' | ||
|
||
export const useContacts = defineQuery(() => { | ||
const searchText = useRouteQuery('search', '', { mode: 'push' }) | ||
const { ...query } = useQuery({ | ||
key: () => ['contacts-search', { searchText: searchText.value }], | ||
query: ({ signal }) => searchContacts(searchText.value, {}, { signal }), | ||
gcTime: 0, | ||
}) | ||
return { ...query, searchText } | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters