Skip to content

Commit

Permalink
fix(react-router): incorrectly returning undefined as `parentMatchP…
Browse files Browse the repository at this point in the history
…romise` in the loader in the child route (#1546)
  • Loading branch information
SeanCassiere authored May 3, 2024
1 parent e659c25 commit ded977f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/react-router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1603,8 +1603,8 @@ export class Router<
const validResolvedMatches = matches.slice(0, firstBadMatchIndex)
const matchPromises: Array<Promise<any>> = []

await Promise.all(
validResolvedMatches.map(async (match, index) => {
validResolvedMatches.forEach((match, index) => {
const createValidateResolvedMatchPromise = async () => {
const parentMatchPromise = matchPromises[index - 1]
const route = this.looseRoutesById[match.routeId]!

Expand Down Expand Up @@ -1815,8 +1815,14 @@ export class Router<
if (match.status !== 'success') {
await fetchWithRedirectAndNotFound()
}
}),
)

return
}

matchPromises.push(createValidateResolvedMatchPromise())
})

await Promise.all(matchPromises)

checkLatest()

Expand Down

0 comments on commit ded977f

Please sign in to comment.