0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/packages/solid-router/src
Flo fe3bb45a7c
refactor(router-core): skip loader and store update if nothing to await (#4926)
Following https://github.com/TanStack/router/pull/4916 and
https://github.com/TanStack/router/pull/4925, this PR keeps reducing the
number of store updates (`__store.setState` through `updateMatch`).

Reduce amount of work in `runLoader`:
- don't `updateMatch` to set `isFetching: 'loader'` if we know the
entire function will be synchronous
- don't await `route.options.loader()` if it is synchronous
- don't update store with `loaderData` if `route.options.loader` is not
defined
- don't `await route._lazyPromise` if it has already resolved
- don't `await route._componentsPromise` if it has already resolved
- don't `await minPendingPromise` if it is not defined or has already
resolved

For a sync `loader`, with already loaded route chunks, `runLoader`
should be synchronous and trigger a single `updateMatch` call.

---

The `store-updates-during-navigation` test tracking the number of
executions of a `useRouterState > select` method during a navigation
goes from **19 calls** without this PR, to **17 calls** with this PR.

---

Should be a partial improvement of
https://github.com/TanStack/router/issues/4359

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
History 2025-08-15 16:41:41 +02:00
..
ssr fefactor: restructure SSR handling between start/router (#4495) 2025-06-26 22:14:57 +02:00
Asset.tsx fix(react-router, solid-router): make head function scripts load properly (#4323) 2025-06-18 22:03:06 +02:00
awaited.tsx fix(solid-router): use createResource and Show in Await (#3591) 2025-02-27 14:30:51 +01:00
CatchBoundary.tsx feat(solid-router): Add a SolidJS driver for TanStack Router (#3276) 2025-02-20 17:11:39 +01:00
ClientOnly.tsx fix: don't run router.load() when hydrating only SSRed matches (#4630) 2025-07-12 01:18:27 +02:00
fileRoute.ts feat: Merge alpha to main (#4365) 2025-06-10 23:19:32 +02:00
HeadContent.tsx feat: Add style to HeadContent (#4559) 2025-07-02 00:28:12 +02:00
history.ts feat(solid-router): Add a SolidJS driver for TanStack Router (#3276) 2025-02-20 17:11:39 +01:00
index.tsx feat: use seroval for SSR (#4600) 2025-07-11 00:25:32 +02:00
lazyRouteComponent.tsx feat: ssr setting per route (#4565) 2025-07-05 14:35:14 +02:00
link.tsx fix(router-core): type mismatch for navigate function (#4625) 2025-07-22 17:32:16 +02:00
Match.tsx refactor(router-core): skip loader and store update if nothing to await (#4926) 2025-08-15 16:41:41 +02:00
matchContext.tsx feat(solid-router): Add a SolidJS driver for TanStack Router (#3276) 2025-02-20 17:11:39 +01:00
Matches.tsx feat(react-router): add disableGlobalCatchBoundary option (#4765) 2025-07-26 22:45:20 +02:00
not-found.tsx fix(router-core): change error type in ErrorComponentProps (#4691) 2025-07-20 07:33:04 +02:00
renderRouteNotFound.tsx refactor(router-core): move AnyRoute and AnyRouter to router-core (#3640) 2025-03-04 21:48:58 +01:00
route.tsx fix(router-plugin): add support for boolean and null literals in code splitter (#4915) 2025-08-13 13:01:57 +12:00
router.ts feat: Merge alpha to main (#4365) 2025-06-10 23:19:32 +02:00
routerContext.tsx refactor(router-core): move AnyRoute and AnyRouter to router-core (#3640) 2025-03-04 21:48:58 +01:00
RouterProvider.tsx refactor(router-core): move AnyRoute and AnyRouter to router-core (#3640) 2025-03-04 21:48:58 +01:00
SafeFragment.tsx feat(solid-router): Add a SolidJS driver for TanStack Router (#3276) 2025-02-20 17:11:39 +01:00
ScriptOnce.tsx fix: remove debug log (#4604) 2025-07-11 19:49:35 +02:00
Scripts.tsx feat(solid-router): Add a SolidJS driver for TanStack Router (#3276) 2025-02-20 17:11:39 +01:00
scroll-restoration.tsx fix: scroll to top with hash history (#4795) 2025-07-27 00:36:40 +02:00
ScrollRestoration.tsx fix: properly handle sessionStorage not being available for scroll restoration (#4186) 2025-05-16 19:03:16 +02:00
Transitioner.tsx fix(solid-router): prevent client effects running on server (#4621) 2025-07-15 22:19:37 +02:00
typePrimitives.ts fix(router-core): move typePrimitives to shared package (#3748) 2025-03-12 13:30:19 +01:00
useBlocker.tsx fix: do not pre-decodeURI before passing to createMemoryHistory (#4893) 2025-08-08 15:36:37 -06:00
useCanGoBack.ts feat(solid-router): Add a SolidJS driver for TanStack Router (#3276) 2025-02-20 17:11:39 +01:00
useLoaderData.tsx refactor(router-core): move AnyRoute and AnyRouter to router-core (#3640) 2025-03-04 21:48:58 +01:00
useLoaderDeps.tsx refactor(router-core): move AnyRoute and AnyRouter to router-core (#3640) 2025-03-04 21:48:58 +01:00
useLocation.tsx refactor(router-core): move AnyRoute and AnyRouter to router-core (#3640) 2025-03-04 21:48:58 +01:00
useMatch.tsx fix(router-core): move ThrowConstraint to core utils (#3749) 2025-03-12 13:54:05 +01:00
useNavigate.tsx fix(router-core): resolve with basepath if to is not supplied (#4472) 2025-06-23 11:23:57 +12:00
useParams.tsx fix(router-core): move ThrowConstraint to core utils (#3749) 2025-03-12 13:54:05 +01:00
useRouteContext.ts refactor(router-core): move AnyRoute and AnyRouter to router-core (#3640) 2025-03-04 21:48:58 +01:00
useRouter.tsx refactor(router-core): move AnyRoute and AnyRouter to router-core (#3640) 2025-03-04 21:48:58 +01:00
useRouterState.tsx refactor(router-core): move AnyRoute and AnyRouter to router-core (#3640) 2025-03-04 21:48:58 +01:00
useSearch.tsx fix(router-core): move ThrowConstraint to core utils (#3749) 2025-03-12 13:54:05 +01:00
utils.ts refactor(router-core): move AnyRoute and AnyRouter to router-core (#3640) 2025-03-04 21:48:58 +01:00