From 27ac027d359cd9de3cadc3af8a2c3f0aefa4d7bc Mon Sep 17 00:00:00 2001 From: James Morris Date: Thu, 27 Mar 2025 16:05:36 +0000 Subject: [PATCH] fix(react-router-with-query): skip client-side redirect handling during ssr --- packages/react-router-with-query/src/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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,