reactjrx 1.109.1 → 1.110.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs
CHANGED
|
@@ -835,12 +835,7 @@ function useMutation$(options, queryClient) {
|
|
|
835
835
|
}
|
|
836
836
|
function useSwitchMutation$(options, queryClient) {
|
|
837
837
|
const [cancel$, cancel] = useObservableCallback();
|
|
838
|
-
const {
|
|
839
|
-
mutate,
|
|
840
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
841
|
-
mutateAsync: _removed,
|
|
842
|
-
...rest
|
|
843
|
-
} = useMutation$(
|
|
838
|
+
const { mutate, mutateAsync, ...rest } = useMutation$(
|
|
844
839
|
{
|
|
845
840
|
...options,
|
|
846
841
|
mutationFn: (variables) => {
|
|
@@ -857,7 +852,14 @@ function useSwitchMutation$(options, queryClient) {
|
|
|
857
852
|
},
|
|
858
853
|
[mutate, cancel]
|
|
859
854
|
);
|
|
860
|
-
|
|
855
|
+
const mutateAsyncSwitch = React.useCallback(
|
|
856
|
+
(variables) => {
|
|
857
|
+
cancel();
|
|
858
|
+
return mutateAsync(variables);
|
|
859
|
+
},
|
|
860
|
+
[mutateAsync, cancel]
|
|
861
|
+
);
|
|
862
|
+
return { ...rest, mutate: mutateSwitch, mutateAsync: mutateAsyncSwitch };
|
|
861
863
|
}
|
|
862
864
|
function hasObjectPrototype(o) {
|
|
863
865
|
return Object.prototype.toString.call(o) === "[object Object]";
|
package/dist/index.js
CHANGED
|
@@ -817,12 +817,7 @@ function useMutation$(options, queryClient) {
|
|
|
817
817
|
}
|
|
818
818
|
function useSwitchMutation$(options, queryClient) {
|
|
819
819
|
const [cancel$, cancel] = useObservableCallback();
|
|
820
|
-
const {
|
|
821
|
-
mutate,
|
|
822
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
823
|
-
mutateAsync: _removed,
|
|
824
|
-
...rest
|
|
825
|
-
} = useMutation$(
|
|
820
|
+
const { mutate, mutateAsync, ...rest } = useMutation$(
|
|
826
821
|
{
|
|
827
822
|
...options,
|
|
828
823
|
mutationFn: (variables) => {
|
|
@@ -839,7 +834,14 @@ function useSwitchMutation$(options, queryClient) {
|
|
|
839
834
|
},
|
|
840
835
|
[mutate, cancel]
|
|
841
836
|
);
|
|
842
|
-
|
|
837
|
+
const mutateAsyncSwitch = useCallback(
|
|
838
|
+
(variables) => {
|
|
839
|
+
cancel();
|
|
840
|
+
return mutateAsync(variables);
|
|
841
|
+
},
|
|
842
|
+
[mutateAsync, cancel]
|
|
843
|
+
);
|
|
844
|
+
return { ...rest, mutate: mutateSwitch, mutateAsync: mutateAsyncSwitch };
|
|
843
845
|
}
|
|
844
846
|
function hasObjectPrototype(o) {
|
|
845
847
|
return Object.prototype.toString.call(o) === "[object Object]";
|
|
@@ -2,6 +2,7 @@ import { DefaultError, QueryClient } from '@tanstack/react-query';
|
|
|
2
2
|
import { UseMutation$Options } from './useMutation$';
|
|
3
3
|
export declare function useSwitchMutation$<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(options: UseMutation$Options<TData | null, TError, TVariables, TContext>, queryClient?: QueryClient): {
|
|
4
4
|
mutate: (variables: TVariables) => void;
|
|
5
|
+
mutateAsync: (variables: TVariables) => Promise<TData | null>;
|
|
5
6
|
state$: import('rxjs').BehaviorSubject<Pick<import('@tanstack/react-query').UseMutationResult<TData | null, TError, TVariables, TContext>, "status" | "isPending" | "isError" | "isSuccess" | "isIdle">>;
|
|
6
7
|
data: undefined;
|
|
7
8
|
variables: undefined;
|
|
@@ -19,6 +20,7 @@ export declare function useSwitchMutation$<TData = unknown, TError = DefaultErro
|
|
|
19
20
|
submittedAt: number;
|
|
20
21
|
} | {
|
|
21
22
|
mutate: (variables: TVariables) => void;
|
|
23
|
+
mutateAsync: (variables: TVariables) => Promise<TData | null>;
|
|
22
24
|
state$: import('rxjs').BehaviorSubject<Pick<import('@tanstack/react-query').UseMutationResult<TData | null, TError, TVariables, TContext>, "status" | "isPending" | "isError" | "isSuccess" | "isIdle">>;
|
|
23
25
|
data: undefined;
|
|
24
26
|
variables: TVariables;
|
|
@@ -36,6 +38,7 @@ export declare function useSwitchMutation$<TData = unknown, TError = DefaultErro
|
|
|
36
38
|
submittedAt: number;
|
|
37
39
|
} | {
|
|
38
40
|
mutate: (variables: TVariables) => void;
|
|
41
|
+
mutateAsync: (variables: TVariables) => Promise<TData | null>;
|
|
39
42
|
state$: import('rxjs').BehaviorSubject<Pick<import('@tanstack/react-query').UseMutationResult<TData | null, TError, TVariables, TContext>, "status" | "isPending" | "isError" | "isSuccess" | "isIdle">>;
|
|
40
43
|
data: undefined;
|
|
41
44
|
error: TError;
|
|
@@ -53,6 +56,7 @@ export declare function useSwitchMutation$<TData = unknown, TError = DefaultErro
|
|
|
53
56
|
submittedAt: number;
|
|
54
57
|
} | {
|
|
55
58
|
mutate: (variables: TVariables) => void;
|
|
59
|
+
mutateAsync: (variables: TVariables) => Promise<TData | null>;
|
|
56
60
|
state$: import('rxjs').BehaviorSubject<Pick<import('@tanstack/react-query').UseMutationResult<TData | null, TError, TVariables, TContext>, "status" | "isPending" | "isError" | "isSuccess" | "isIdle">>;
|
|
57
61
|
data: TData | null;
|
|
58
62
|
error: null;
|