Stabilize mobile auth session handling
This commit is contained in:
+8
-2
@@ -1,6 +1,6 @@
|
||||
import { MutationCache, QueryCache, QueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { isUnauthorizedError } from "@/lib/trpc-errors";
|
||||
import { isRateLimitError, isUnauthorizedError } from "@/lib/trpc-errors";
|
||||
|
||||
export function createAppQueryClient(onUnauthorized: () => void) {
|
||||
const handleError = (error: unknown) => {
|
||||
@@ -16,7 +16,13 @@ export function createAppQueryClient(onUnauthorized: () => void) {
|
||||
queries: {
|
||||
staleTime: 30_000,
|
||||
retry: (failureCount, error) => {
|
||||
if (isUnauthorizedError(error)) return false;
|
||||
if (isUnauthorizedError(error) || isRateLimitError(error)) return false;
|
||||
return failureCount < 1;
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
retry: (failureCount, error) => {
|
||||
if (isRateLimitError(error)) return false;
|
||||
return failureCount < 1;
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user