diff --git a/packages/react-router-with-query/src/index.tsx b/packages/react-router-with-query/src/index.tsx index e26bcf2975..4efc16a2c9 100644 --- a/packages/react-router-with-query/src/index.tsx +++ b/packages/react-router-with-query/src/index.tsx @@ -116,7 +116,7 @@ export function routerWithQueryClient( queryClient.getMutationCache().config = { ...ogMutationCacheConfig, onError: (error, _variables, _context, _mutation) => { - if (isRedirect(error)) { + if (isRedirect(error) && !router.isServer) { return router.navigate( router.resolveRedirect({ ...error, @@ -138,7 +138,7 @@ export function routerWithQueryClient( queryClient.getQueryCache().config = { ...ogQueryCacheConfig, onError: (error, _query) => { - if (isRedirect(error)) { + if (isRedirect(error) && !router.isServer) { return router.navigate( router.resolveRedirect({ ...error,