Skip to content

Commit 1c5614b

Browse files
committed
Avoid running multiple loads in parallel
1 parent d9ff643 commit 1c5614b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/router-core/src/router.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,6 +1963,13 @@ export class RouterCore<
19631963
let redirect: ResolvedRedirect | undefined
19641964
let notFound: NotFoundError | undefined
19651965

1966+
// Wait for any in-progress loads to finish before triggering another.
1967+
while (
1968+
(this.latestLoadPromise as any)
1969+
) {
1970+
await this.latestLoadPromise
1971+
}
1972+
19661973
let loadPromise: Promise<void>
19671974

19681975
// eslint-disable-next-line prefer-const

0 commit comments

Comments
 (0)