Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
63ed328
WIP remove pending from store (2nd attempt)
Sheraff Feb 15, 2026
9a21d5a
ci: apply automated fixes
autofix-ci[bot] Feb 15, 2026
89a7c50
update test expectations & snapshots
Sheraff Feb 15, 2026
565a264
Merge branch 'main' into refactor-router-core-remove-pending-from-sto…
Sheraff Feb 15, 2026
c1d7217
refactor(router-core): remove cachedMatches from reactive store
Sheraff Feb 15, 2026
8dfbe98
ci: apply automated fixes
autofix-ci[bot] Feb 15, 2026
de355d2
refactor(router-devtools-core): restore visibility into internalized …
Sheraff Feb 15, 2026
70520b0
ci: apply automated fixes
autofix-ci[bot] Feb 15, 2026
03e62e5
fix typo
Sheraff Feb 15, 2026
787d207
cleanup naming for public API
Sheraff Feb 16, 2026
52f0ee3
fix type
Sheraff Feb 16, 2026
f8d59ed
more cleanup
Sheraff Feb 16, 2026
3487aa6
ci: apply automated fixes
autofix-ci[bot] Feb 16, 2026
0031d51
even more cleanup
Sheraff Feb 16, 2026
9a965e9
avoid route matching in store selector
Sheraff Feb 16, 2026
8b70006
tighten store-update counts
Sheraff Feb 16, 2026
9548175
vue-router useMatch lazy pending matches check
Sheraff Feb 16, 2026
e4a1ccb
Merge branch 'main' into refactor-router-core-remove-cached-pending-m…
Sheraff Feb 16, 2026
ed8354c
this works?
Sheraff Feb 16, 2026
bf75ae0
how about this?
Sheraff Feb 16, 2026
c183fcf
Merge branch 'main' into refactor-router-core-remove-cached-pending-m…
Sheraff Feb 20, 2026
a994c0b
merge cleanup
Sheraff Feb 20, 2026
3a5212a
ci: apply automated fixes
autofix-ci[bot] Feb 20, 2026
b3a4053
re-migrate to new Store, merge errors
Sheraff Feb 20, 2026
4d720aa
Merge branch 'main' into refactor-router-core-remove-cached-pending-m…
Sheraff Feb 21, 2026
27a14cd
fix tests
Sheraff Feb 22, 2026
6db78a8
skip updating internalStore when committing staying matches
Sheraff Feb 22, 2026
a5fcf0f
Merge branch 'main' into refactor-router-core-remove-cached-pending-m…
Sheraff Feb 22, 2026
ca8acb6
Merge branch 'main' into refactor-router-core-remove-cached-pending-m…
Sheraff Mar 3, 2026
5f4b145
Merge branch 'main' into refactor-router-core-remove-cached-pending-m…
Sheraff Mar 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions docs/router/api/router/RouterStateType.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ id: RouterStateType
title: RouterState type
---

The `RouterState` type represents shape of the internal state of the router. The Router's internal state is useful, if you need to access certain internals of the router, such as any pending matches, is the router in its loading state, etc.
The `RouterState` type represents the shape of the internal state of the router. The Router's internal state is useful if you need to access certain internals of the router, such as whether it is currently loading.

```tsx
type RouterState = {
status: 'pending' | 'idle'
isLoading: boolean
isTransitioning: boolean
matches: Array<RouteMatch>
pendingMatches: Array<RouteMatch>
location: ParsedLocation
resolvedLocation: ParsedLocation
}
Expand All @@ -21,6 +20,14 @@ type RouterState = {

The `RouterState` type contains all of the properties that are available on the router state.

## Migration notes

If you previously used `router.state.pendingMatches`, use one of these patterns instead:

- `router.state.status === 'pending'` to detect an in-flight navigation.
- `router.state.isLoading` to detect active loading work.
- `useStore(router.internalStore, (s) => s.pendingMatches)` when you need access to pending route matches.

### `status` property

- Type: `'pending' | 'idle'`
Expand All @@ -41,11 +48,6 @@ The `RouterState` type contains all of the properties that are available on the
- Type: [`Array<RouteMatch>`](./RouteMatchType.md)
- An array of all of the route matches that have been resolved and are currently active.

### `pendingMatches` property

- Type: [`Array<RouteMatch>`](./RouteMatchType.md)
- An array of all of the route matches that are currently pending.

### `location` property

- Type: [`ParsedLocation`](./ParsedLocationType.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/router/api/router/useChildMatchesHook.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: useChildMatches hook
The `useChildMatches` hook returns all of the child [`RouteMatch`](./RouteMatchType.md) objects from the closest match down to the leaf-most match. **It does not include the current match, which can be obtained using the `useMatch` hook.**

> [!IMPORTANT]
> If the router has pending matches and they are showing their pending component fallbacks, `router.state.pendingMatches` will used instead of `router.state.matches`.
> If the router has pending matches and they are showing their pending component fallbacks, an array of pending matches will be used instead of `router.state.matches`.

## useChildMatches options

Expand Down
2 changes: 1 addition & 1 deletion docs/router/api/router/useParentMatchesHook.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: useParentMatches hook
The `useParentMatches` hook returns all of the parent [`RouteMatch`](./RouteMatchType.md) objects from the root down to the immediate parent of the current match in context. **It does not include the current match, which can be obtained using the `useMatch` hook.**

> [!IMPORTANT]
> If the router has pending matches and they are showing their pending component fallbacks, `router.state.pendingMatches` will used instead of `router.state.matches`.
> If the router has pending matches and they are showing their pending component fallbacks, an array of pending matches will be used instead of `router.state.matches`.

## useParentMatches options

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ describe("Store doesn't update *too many* times during navigation", () => {
// This number should be as small as possible to minimize the amount of work
// that needs to be done during a navigation.
// Any change that increases this number should be investigated.
expect(updates).toBeGreaterThanOrEqual(10) // WARN: this is flaky, and sometimes (rarely) is 12
expect(updates).toBeLessThanOrEqual(13)
expect(updates).toBe(8)
})

test('redirection in preload', async () => {
Expand All @@ -155,7 +154,7 @@ describe("Store doesn't update *too many* times during navigation", () => {
// This number should be as small as possible to minimize the amount of work
// that needs to be done during a navigation.
// Any change that increases this number should be investigated.
expect(updates).toBe(4)
expect(updates).toBe(1)
})

test('sync beforeLoad', async () => {
Expand All @@ -171,8 +170,7 @@ describe("Store doesn't update *too many* times during navigation", () => {
// This number should be as small as possible to minimize the amount of work
// that needs to be done during a navigation.
// Any change that increases this number should be investigated.
expect(updates).toBeGreaterThanOrEqual(9) // WARN: this is flaky
expect(updates).toBeLessThanOrEqual(12)
expect(updates).toBe(5)
})

test('nothing', async () => {
Expand All @@ -183,8 +181,7 @@ describe("Store doesn't update *too many* times during navigation", () => {
// This number should be as small as possible to minimize the amount of work
// that needs to be done during a navigation.
// Any change that increases this number should be investigated.
expect(updates).toBeGreaterThanOrEqual(6) // WARN: this is flaky, and sometimes (rarely) is 9
expect(updates).toBeLessThanOrEqual(9)
expect(updates).toBe(3)
})

test('not found in beforeLoad', async () => {
Expand All @@ -199,7 +196,7 @@ describe("Store doesn't update *too many* times during navigation", () => {
// This number should be as small as possible to minimize the amount of work
// that needs to be done during a navigation.
// Any change that increases this number should be investigated.
expect(updates).toBe(7)
expect(updates).toBe(2)
})

test('hover preload, then navigate, w/ async loaders', async () => {
Expand All @@ -225,7 +222,7 @@ describe("Store doesn't update *too many* times during navigation", () => {
// This number should be as small as possible to minimize the amount of work
// that needs to be done during a navigation.
// Any change that increases this number should be investigated.
expect(updates).toBe(15)
expect(updates).toBe(5)
})

test('navigate, w/ preloaded & async loaders', async () => {
Expand All @@ -241,8 +238,7 @@ describe("Store doesn't update *too many* times during navigation", () => {
// This number should be as small as possible to minimize the amount of work
// that needs to be done during a navigation.
// Any change that increases this number should be investigated.
expect(updates).toBeGreaterThanOrEqual(7)
expect(updates).toBeLessThanOrEqual(8)
expect(updates).toBe(3)
})

test('navigate, w/ preloaded & sync loaders', async () => {
Expand All @@ -258,7 +254,7 @@ describe("Store doesn't update *too many* times during navigation", () => {
// This number should be as small as possible to minimize the amount of work
// that needs to be done during a navigation.
// Any change that increases this number should be investigated.
expect(updates).toBe(6)
expect(updates).toBe(3)
})

test('navigate, w/ previous navigation & async loader', async () => {
Expand All @@ -274,7 +270,7 @@ describe("Store doesn't update *too many* times during navigation", () => {
// This number should be as small as possible to minimize the amount of work
// that needs to be done during a navigation.
// Any change that increases this number should be investigated.
expect(updates).toBe(5)
expect(updates).toBe(3)
})

test('preload a preloaded route w/ async loader', async () => {
Expand All @@ -292,6 +288,6 @@ describe("Store doesn't update *too many* times during navigation", () => {
// This number should be as small as possible to minimize the amount of work
// that needs to be done during a navigation.
// Any change that increases this number should be investigated.
expect(updates).toBe(1)
expect(updates).toBe(0)
})
})
1 change: 1 addition & 0 deletions packages/router-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ export type {
MatchRouteFn,
RouterContextOptions,
RouterOptions,
InternalStoreState,
RouterConstructorOptions,
UpdateFn,
ParseLocationFn,
Expand Down
Loading
Loading