@trpc/tanstack-react-query 11.18.1-canary.19 → 11.18.1-canary.30
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 +170 -242
- package/dist/index.d.cts +7 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +7 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +158 -254
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/internals/Context.tsx +1 -4
- package/src/internals/createOptionsProxy.ts +10 -8
- package/src/internals/infiniteQueryOptions.ts +19 -11
- package/src/internals/mutationOptions.ts +3 -1
- package/src/internals/queryOptions.ts +18 -6
- package/src/internals/subscriptionOptions.ts +19 -15
- package/src/internals/types.ts +2 -4
|
@@ -33,7 +33,9 @@ interface TRPCSubscriptionOptionsOut<
|
|
|
33
33
|
TOutput,
|
|
34
34
|
TError,
|
|
35
35
|
TFeatureFlags extends FeatureFlags,
|
|
36
|
-
>
|
|
36
|
+
>
|
|
37
|
+
extends
|
|
38
|
+
UnusedSkipTokenTRPCSubscriptionOptionsIn<TOutput, TError>,
|
|
37
39
|
TRPCQueryOptionsResult {
|
|
38
40
|
enabled: boolean;
|
|
39
41
|
queryKey: TRPCQueryKey<TFeatureFlags['keyPrefix']>;
|
|
@@ -70,10 +72,7 @@ export interface TRPCSubscriptionOptions<
|
|
|
70
72
|
>;
|
|
71
73
|
}
|
|
72
74
|
export type TRPCSubscriptionStatus =
|
|
73
|
-
| '
|
|
74
|
-
| 'connecting'
|
|
75
|
-
| 'pending'
|
|
76
|
-
| 'error';
|
|
75
|
+
'idle' | 'connecting' | 'pending' | 'error';
|
|
77
76
|
|
|
78
77
|
export interface TRPCSubscriptionBaseResult<TOutput, TError> {
|
|
79
78
|
status: TRPCSubscriptionStatus;
|
|
@@ -85,29 +84,35 @@ export interface TRPCSubscriptionBaseResult<TOutput, TError> {
|
|
|
85
84
|
reset: () => void;
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
export interface TRPCSubscriptionIdleResult<
|
|
89
|
-
|
|
87
|
+
export interface TRPCSubscriptionIdleResult<
|
|
88
|
+
TOutput,
|
|
89
|
+
> extends TRPCSubscriptionBaseResult<TOutput, null> {
|
|
90
90
|
status: 'idle';
|
|
91
91
|
data: undefined;
|
|
92
92
|
error: null;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
export interface TRPCSubscriptionConnectingResult<
|
|
96
|
-
|
|
95
|
+
export interface TRPCSubscriptionConnectingResult<
|
|
96
|
+
TOutput,
|
|
97
|
+
TError,
|
|
98
|
+
> extends TRPCSubscriptionBaseResult<TOutput, TError> {
|
|
97
99
|
status: 'connecting';
|
|
98
100
|
data: undefined | TOutput;
|
|
99
101
|
error: TError | null;
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
export interface TRPCSubscriptionPendingResult<
|
|
103
|
-
|
|
104
|
+
export interface TRPCSubscriptionPendingResult<
|
|
105
|
+
TOutput,
|
|
106
|
+
> extends TRPCSubscriptionBaseResult<TOutput, undefined> {
|
|
104
107
|
status: 'pending';
|
|
105
108
|
data: TOutput | undefined;
|
|
106
109
|
error: null;
|
|
107
110
|
}
|
|
108
111
|
|
|
109
|
-
export interface TRPCSubscriptionErrorResult<
|
|
110
|
-
|
|
112
|
+
export interface TRPCSubscriptionErrorResult<
|
|
113
|
+
TOutput,
|
|
114
|
+
TError,
|
|
115
|
+
> extends TRPCSubscriptionBaseResult<TOutput, TError> {
|
|
111
116
|
status: 'error';
|
|
112
117
|
data: TOutput | undefined;
|
|
113
118
|
error: TError;
|
|
@@ -150,7 +155,7 @@ export const trpcSubscriptionOptions = <
|
|
|
150
155
|
>['subscribe'] = (innerOpts) => {
|
|
151
156
|
return subscribe(
|
|
152
157
|
path.join('.'),
|
|
153
|
-
input === skipToken ? undefined :
|
|
158
|
+
input === skipToken ? undefined : input,
|
|
154
159
|
innerOpts,
|
|
155
160
|
);
|
|
156
161
|
};
|
|
@@ -245,7 +250,6 @@ export function useSubscription<TOutput, TError>(
|
|
|
245
250
|
currentSubscriptionRef.current = () => {
|
|
246
251
|
subscription.unsubscribe();
|
|
247
252
|
};
|
|
248
|
-
// eslint-disable-next-line react-hooks/react-compiler
|
|
249
253
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
250
254
|
}, [hashKey(opts.queryKey), opts.enabled]);
|
|
251
255
|
|
package/src/internals/types.ts
CHANGED
|
@@ -103,8 +103,7 @@ export type TRPCQueryKey<TPrefixEnabled extends boolean = false> =
|
|
|
103
103
|
: TRPCQueryKeyWithoutPrefix;
|
|
104
104
|
|
|
105
105
|
export type AnyTRPCQueryKey =
|
|
106
|
-
|
|
|
107
|
-
| TRPCQueryKeyWithPrefix;
|
|
106
|
+
TRPCQueryKeyWithoutPrefix | TRPCQueryKeyWithPrefix;
|
|
108
107
|
|
|
109
108
|
/**
|
|
110
109
|
* @public
|
|
@@ -120,8 +119,7 @@ export type TRPCMutationKeyWithPrefix = [
|
|
|
120
119
|
export type TRPCMutationKeyWithoutPrefix = [path: string[]];
|
|
121
120
|
|
|
122
121
|
export type AnyTRPCMutationKey =
|
|
123
|
-
|
|
|
124
|
-
| TRPCMutationKeyWithPrefix;
|
|
122
|
+
TRPCMutationKeyWithoutPrefix | TRPCMutationKeyWithPrefix;
|
|
125
123
|
|
|
126
124
|
/**
|
|
127
125
|
* @public
|