-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: isolate wagmi's React Query
queryClient
instance. (#963)
* feat: Isolate wagmi query context from react-query default context * move context addition into custom query hooks * alphabetize exports * change imports to be from utils instead of utils/query * export useMutation and useQueryClient hooks from react package * add changeset * tests: update snapshots * refactor: rename imports * chore: update changeset Co-authored-by: moxey.eth <jakemoxey@gmail.com>
- Loading branch information
Showing
23 changed files
with
137 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'wagmi': patch | ||
--- | ||
|
||
Isolate wagmi's React Query `queryClient` instance. |
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export { useBaseQuery } from './useBaseQuery' | ||
export { useInfiniteQuery } from './useInfiniteQuery' | ||
export { useMutation } from './useMutation' | ||
export { useQuery } from './useQuery' | ||
export { useQueryClient } from './useQueryClient' |
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,78 @@ | ||
import { | ||
MutationFunction, | ||
MutationKey, | ||
UseMutationOptions, | ||
UseMutationResult, | ||
parseMutationArgs, | ||
useMutation as useMutation_, | ||
} from '@tanstack/react-query' | ||
|
||
import { queryClientContext as context } from '../../../context' | ||
|
||
export function useMutation< | ||
TData = unknown, | ||
TError = unknown, | ||
TVariables = void, | ||
TContext = unknown, | ||
>( | ||
options: UseMutationOptions<TData, TError, TVariables, TContext>, | ||
): UseMutationResult<TData, TError, TVariables, TContext> | ||
|
||
export function useMutation< | ||
TData = unknown, | ||
TError = unknown, | ||
TVariables = void, | ||
TContext = unknown, | ||
>( | ||
mutationFn: MutationFunction<TData, TVariables>, | ||
options?: Omit< | ||
UseMutationOptions<TData, TError, TVariables, TContext>, | ||
'mutationFn' | ||
>, | ||
): UseMutationResult<TData, TError, TVariables, TContext> | ||
|
||
export function useMutation< | ||
TData = unknown, | ||
TError = unknown, | ||
TVariables = void, | ||
TContext = unknown, | ||
>( | ||
mutationKey: MutationKey, | ||
options?: Omit< | ||
UseMutationOptions<TData, TError, TVariables, TContext>, | ||
'mutationKey' | ||
>, | ||
): UseMutationResult<TData, TError, TVariables, TContext> | ||
|
||
export function useMutation< | ||
TData = unknown, | ||
TError = unknown, | ||
TVariables = void, | ||
TContext = unknown, | ||
>( | ||
mutationKey: MutationKey, | ||
mutationFn?: MutationFunction<TData, TVariables>, | ||
options?: Omit< | ||
UseMutationOptions<TData, TError, TVariables, TContext>, | ||
'mutationKey' | 'mutationFn' | ||
>, | ||
): UseMutationResult<TData, TError, TVariables, TContext> | ||
|
||
export function useMutation< | ||
TData = unknown, | ||
TError = unknown, | ||
TVariables = void, | ||
TContext = unknown, | ||
>( | ||
arg1: | ||
| MutationKey | ||
| MutationFunction<TData, TVariables> | ||
| UseMutationOptions<TData, TError, TVariables, TContext>, | ||
arg2?: | ||
| MutationFunction<TData, TVariables> | ||
| UseMutationOptions<TData, TError, TVariables, TContext>, | ||
arg3?: UseMutationOptions<TData, TError, TVariables, TContext>, | ||
): UseMutationResult<TData, TError, TVariables, TContext> { | ||
const options = parseMutationArgs(arg1, arg2, arg3) | ||
return useMutation_({ context, ...options }) | ||
} |
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,5 @@ | ||
import { useQueryClient as useQueryClient_ } from '@tanstack/react-query' | ||
|
||
import { queryClientContext as context } from '../../../context' | ||
|
||
export const useQueryClient = () => useQueryClient_({ context }) |
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
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
8ea29e2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
wagmi – ./
wagmi-git-main-wagmi-dev.vercel.app
next.wagmi.sh
wagmi-wagmi-dev.vercel.app
www.wagmi.sh
wagmi-xyz.vercel.app