Skip to content

Commit 193be16

Browse files
committed
fix gc time for mutations and queries
1 parent 768ef94 commit 193be16

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/react-query-external-sync/hydration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function dehydrateMutation(mutation: Mutation): DehydratedMutation {
4949
mutationId: mutation.mutationId,
5050
mutationKey: mutation.options.mutationKey,
5151
state: mutation.state,
52+
gcTime: mutation.gcTime,
5253
...(mutation.options.scope && { scope: mutation.options.scope }),
5354
...(mutation.meta && { meta: mutation.meta }),
5455
};
@@ -72,6 +73,7 @@ function dehydrateQuery(query: Query): DehydratedQuery {
7273
},
7374
queryKey: query.queryKey,
7475
queryHash: query.queryHash,
76+
gcTime: query.gcTime,
7577
...(query.meta && { meta: query.meta }),
7678
observers: observerStates,
7779
};

src/react-query-external-sync/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export interface DehydratedMutation {
3333
state: MutationState;
3434
meta?: MutationMeta;
3535
scope?: MutationScope;
36+
gcTime?: number;
3637
}
3738
export interface DehydratedQuery {
3839
queryHash: string;
@@ -41,6 +42,7 @@ export interface DehydratedQuery {
4142
promise?: Promise<unknown>;
4243
meta?: QueryMeta;
4344
observers: ObserverState[];
45+
gcTime?: number;
4446
}
4547
export interface ObserverState<
4648
TQueryFnData = unknown,

0 commit comments

Comments
 (0)