Skip to content
Source
Sign inSign up
TanStack/router

fix: extract props from validator issues #3708

Closedjkazimierczak(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/3708/headopened

Showing 3 changed files with 69 additions and 2 deletions.

x
0 of 3 viewed, 3 left
5 additions and 2 deletionspackages/react-start-client/src/createServerFn.tsModified
View file
@@ -1,6 +1,7 @@
import { default as invariant } from 'tiny-invariant'
import { default as warning } from 'tiny-warning'
import { isNotFound, isRedirect } from '@tanstack/react-router'
+import { normalizeValidatorIssues } from '@tanstack/router-core'
import { mergeHeaders } from './headers'
import { globalMiddleware } from './registerGlobalMiddleware'
import { startSerializer } from './serializer'
@@ -802,8 +803,10 @@
if (result instanceof Promise)
throw new Error('Async validation not supported')
​
- if (result.issues)
- throw new Error(JSON.stringify(result.issues, undefined, 2))
+ if (result.issues) {
+ const issues = normalizeValidatorIssues(result.issues)
+ throw new Error(JSON.stringify(issues, undefined, 2))
+ }
​
return result.value
1 addition and 0 deletionspackages/router-core/src/index.tsModified
View file