Skip to content

Commit b600f0e

Browse files
Katarina Antonkaciakmaciak
authored andcommitted
refactor: set cancelRefetch explicitly to false
resolves #69
1 parent 430331b commit b600f0e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/use-observable-query-fn.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ export function useObservableQueryFn<
5858
// If we do not invalidate the query, the hook will never re-subscribe,
5959
// as data are otherwise marked as fresh.
6060
result.cancel = () => {
61-
queryClient.invalidateQueries(queryKey);
61+
queryClient.invalidateQueries(queryKey, undefined, {
62+
cancelRefetch: false,
63+
});
6264
};
6365

6466
// @todo: Skip subscription for SSR
@@ -82,7 +84,9 @@ export function useObservableQueryFn<
8284
return of(undefined);
8385
}),
8486
finalize(() => {
85-
queryClient.invalidateQueries(queryKey);
87+
queryClient.invalidateQueries(queryKey, undefined, {
88+
cancelRefetch: false,
89+
});
8690
})
8791
)
8892
.subscribe();

0 commit comments

Comments
 (0)