mirror of
https://github.com/TanStack/router.git
synced 2026-11-16 19:38:07 +00:00
The `loadMatches` has an unnecessary complicated async setup, probably
due to how complicated the function was before recent cleanups:
```ts
async function loadMatches() {
try {
await new Promise((resolve, reject) => {
;(async () => {
try {
// the logic
resolve()
} catch (err) {
reject(err)
}
})()
})
// after promise
} catch (err) {
// error handling
}
}
```
Aside from some scheduling differences due to unnecessary promises in
the above example, this can be simplified down to this:
```ts
async function loadMatches() {
try {
// the logic
// after promise
} catch (err) {
// error handling
}
}
```
This is what this PR does.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- New Features
- No user-facing changes.
- Refactor
- Simplified internal async flow for route loading, removing redundant
promise wrapping.
- Maintains existing behavior and public API; no action required from
users.
- More consistent error handling and slightly reduced overhead during
parallel loads.
- Improves maintainability and prepares the codebase for future
enhancements.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
|
History
|
|
|---|---|---|
| .. | ||
| lazy | ||
| blocker.test.tsx | ||
| ClientOnly.test.tsx | ||
| createLazyRoute.test.tsx | ||
| disableGlobalCatchBoundary.test.tsx | ||
| errorComponent.test.tsx | ||
| fileRoute.test-d.tsx | ||
| fileRoute.test.ts | ||
| link.bench.tsx | ||
| link.test-d.tsx | ||
| link.test.tsx | ||
| loaders.test.tsx | ||
| Matches.test-d.tsx | ||
| Matches.test.tsx | ||
| navigate.test.tsx | ||
| not-found.test.tsx | ||
| optional-path-params.test-d.tsx | ||
| optional-path-params.test.tsx | ||
| redirect.test.tsx | ||
| redirects.test-d.tsx | ||
| route.test-d.tsx | ||
| route.test.tsx | ||
| routeApi.test-d.tsx | ||
| routeContext.test.tsx | ||
| router.test-d.tsx | ||
| router.test.tsx | ||
| RouterProvider.test-d.tsx | ||
| Scripts.test.tsx | ||
| searchMiddleware.test.tsx | ||
| setupTests.tsx | ||
| store-updates-during-navigation.test.tsx | ||
| useBlocker.test-d.tsx | ||
| useBlocker.test.tsx | ||
| useCanGoBack.test.tsx | ||
| useLoaderData.test-d.tsx | ||
| useLocation.test-d.tsx | ||
| useMatch.test-d.tsx | ||
| useMatch.test.tsx | ||
| useNavigate.test-d.tsx | ||
| useNavigate.test.tsx | ||
| useParams.test-d.tsx | ||
| useRouteContext.test-d.tsx | ||
| useRouterState.test-d.tsx | ||
| useSearch.test-d.tsx | ||
| utils.ts | ||