Skip to content

Commit 2e8a34b

Browse files
yanghuidongclaude
andcommitted
fix: revert unnecessary null check that broke TypeScript
The null check at line 862 was incorrect. That code runs synchronously (doesn't wait for async loader), so match exists there. Only the async callback's finally block needs null check for race conditions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 90d4ba3 commit 2e8a34b

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

packages/router-core/src/load-matches.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -859,19 +859,17 @@ const loadRouteMatch = async (
859859
}
860860
}
861861
}
862-
const match = inner.router.getMatch(matchId)
863-
if (match) {
864-
if (!loaderIsRunningAsync) {
865-
match._nonReactive.loaderPromise?.resolve()
866-
match._nonReactive.loadPromise?.resolve()
867-
}
868-
869-
clearTimeout(match._nonReactive.pendingTimeout)
870-
match._nonReactive.pendingTimeout = undefined
871-
if (!loaderIsRunningAsync) match._nonReactive.loaderPromise = undefined
872-
match._nonReactive.dehydrated = undefined
862+
const match = inner.router.getMatch(matchId)!
863+
if (!loaderIsRunningAsync) {
864+
match._nonReactive.loaderPromise?.resolve()
865+
match._nonReactive.loadPromise?.resolve()
873866
}
874867

868+
clearTimeout(match._nonReactive.pendingTimeout)
869+
match._nonReactive.pendingTimeout = undefined
870+
if (!loaderIsRunningAsync) match._nonReactive.loaderPromise = undefined
871+
match._nonReactive.dehydrated = undefined
872+
875873
// Commit context now that loader has completed (or was skipped)
876874
// For async loaders, this was already done in the async callback
877875
if (!loaderIsRunningAsync) {

0 commit comments

Comments
 (0)