Skip to content

Commit 9d38c38

Browse files
authored
fix: fix Rest Parameters of react-router-ssr-query (#5379)
1 parent 99d3fd0 commit 9d38c38

File tree

1 file changed

+4
-9
lines changed
  • packages/router-ssr-query-core/src

1 file changed

+4
-9
lines changed

packages/router-ssr-query-core/src/index.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,31 +133,26 @@ export function setupCoreRouterSsrQueryIntegration<TRouter extends AnyRouter>({
133133
const ogMutationCacheConfig = queryClient.getMutationCache().config
134134
queryClient.getMutationCache().config = {
135135
...ogMutationCacheConfig,
136-
onError: (error, _variables, _context, _mutation) => {
136+
onError: (error, ...rest) => {
137137
if (isRedirect(error)) {
138138
error.options._fromLocation = router.state.location
139139
return router.navigate(router.resolveRedirect(error).options)
140140
}
141141

142-
return ogMutationCacheConfig.onError?.(
143-
error,
144-
_variables,
145-
_context,
146-
_mutation,
147-
)
142+
return ogMutationCacheConfig.onError?.(error, ...rest)
148143
},
149144
}
150145

151146
const ogQueryCacheConfig = queryClient.getQueryCache().config
152147
queryClient.getQueryCache().config = {
153148
...ogQueryCacheConfig,
154-
onError: (error, _query) => {
149+
onError: (error, ...rest) => {
155150
if (isRedirect(error)) {
156151
error.options._fromLocation = router.state.location
157152
return router.navigate(router.resolveRedirect(error).options)
158153
}
159154

160-
return ogQueryCacheConfig.onError?.(error, _query)
155+
return ogQueryCacheConfig.onError?.(error, ...rest)
161156
},
162157
}
163158
}

0 commit comments

Comments
 (0)