Skip to content

Commit

Permalink
fix: active match preloads now save to state properly
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerlinsley committed Dec 7, 2024
1 parent 412f664 commit 45fc0ef
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions packages/react-router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2821,24 +2821,11 @@ export class Router<
})
})

const activeMatchIds = new Set(
[...this.state.matches, ...(this.state.pendingMatches ?? [])].map(
(d) => d.id,
),
)

try {
matches = await this.loadMatches({
matches,
location: next,
preload: true,
updateMatch: (id, updater) => {
if (activeMatchIds.has(id)) {
matches = matches.map((d) => (d.id === id ? updater(d) : d))
} else {
this.updateMatch(id, updater)
}
},
})

return matches
Expand Down

0 comments on commit 45fc0ef

Please sign in to comment.