Skip to content

Commit a4bfbf1

Browse files
fix: replace array at by reverse to ensure compatibility with older browsers (#986)
fixes #925
1 parent c054f26 commit a4bfbf1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/react-router/src/router.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,8 @@ export class Router<
710710
): ParsedLocation => {
711711
const from = this.latestLocation
712712
const fromSearch =
713-
(this.state.pendingMatches || this.state.matches).at(-1)?.search ||
714-
from.search
713+
(this.state.pendingMatches || this.state.matches).reverse()[0]
714+
?.search || from.search
715715
let pathname = this.resolvePathWithBase(from.pathname, `${dest.to ?? ''}`)
716716

717717
const fromMatches = this.matchRoutes(from.pathname, fromSearch)

0 commit comments

Comments
 (0)