@trpc/react-query 11.0.0-alpha-tmp-issues-5851-take-two.499 → 11.0.0-alpha-tmp-subscription-connection-state.485
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/bundle-analysis.json +76 -54
- package/dist/createTRPCReact.d.ts +3 -3
- package/dist/createTRPCReact.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -1
- package/dist/internals/context.d.ts +18 -2
- package/dist/internals/context.d.ts.map +1 -1
- package/dist/internals/getQueryKey.d.ts +8 -0
- package/dist/internals/getQueryKey.d.ts.map +1 -1
- package/dist/internals/getQueryKey.js +15 -0
- package/dist/internals/getQueryKey.mjs +14 -1
- package/dist/shared/hooks/createHooksInternal.d.ts +2 -2
- package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
- package/dist/shared/hooks/createHooksInternal.js +67 -3
- package/dist/shared/hooks/createHooksInternal.mjs +68 -4
- package/dist/shared/hooks/types.d.ts +171 -2
- package/dist/shared/hooks/types.d.ts.map +1 -1
- package/dist/shared/hooks/types.js +133 -0
- package/dist/shared/hooks/types.mjs +126 -0
- package/dist/shared/index.js +7 -0
- package/dist/shared/index.mjs +1 -0
- package/dist/shared/proxy/utilsProxy.d.ts +12 -4
- package/dist/shared/proxy/utilsProxy.d.ts.map +1 -1
- package/dist/shared/proxy/utilsProxy.js +14 -2
- package/dist/shared/proxy/utilsProxy.mjs +15 -3
- package/dist/utils/createUtilityFunctions.d.ts.map +1 -1
- package/dist/utils/createUtilityFunctions.js +23 -0
- package/dist/utils/createUtilityFunctions.mjs +23 -0
- package/package.json +6 -6
- package/src/createTRPCReact.tsx +11 -2
- package/src/index.ts +1 -1
- package/src/internals/context.tsx +26 -1
- package/src/internals/getQueryKey.ts +21 -0
- package/src/shared/hooks/createHooksInternal.tsx +146 -18
- package/src/shared/hooks/types.ts +365 -1
- package/src/shared/proxy/utilsProxy.ts +47 -6
- package/src/utils/createUtilityFunctions.ts +26 -0
|
@@ -145,5 +145,31 @@ export function createUtilityFunctions<TRouter extends AnyRouter>(
|
|
|
145
145
|
getInfiniteQueryData: (queryKey) => {
|
|
146
146
|
return queryClient.getQueryData(queryKey);
|
|
147
147
|
},
|
|
148
|
+
|
|
149
|
+
setMutationDefaults: (mutationKey, options) => {
|
|
150
|
+
const path = mutationKey[0];
|
|
151
|
+
const canonicalMutationFn = (input: unknown) => {
|
|
152
|
+
return untypedClient.mutation(
|
|
153
|
+
...getClientArgs([path, { input }], opts),
|
|
154
|
+
);
|
|
155
|
+
};
|
|
156
|
+
return queryClient.setMutationDefaults(
|
|
157
|
+
mutationKey,
|
|
158
|
+
typeof options === 'function'
|
|
159
|
+
? options({ canonicalMutationFn })
|
|
160
|
+
: options,
|
|
161
|
+
);
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
getMutationDefaults: (mutationKey) => {
|
|
165
|
+
return queryClient.getMutationDefaults(mutationKey);
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
isMutating: (filters) => {
|
|
169
|
+
return queryClient.isMutating({
|
|
170
|
+
...filters,
|
|
171
|
+
exact: true,
|
|
172
|
+
});
|
|
173
|
+
},
|
|
148
174
|
};
|
|
149
175
|
}
|