@tanstack/router-core 0.0.1-beta.13 → 0.0.1-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/router-core",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-beta.13",
4
+ "version": "0.0.1-beta.14",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
package/src/router.ts CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  History,
7
7
  MemoryHistory,
8
8
  } from 'history'
9
+ import React from 'react'
9
10
  import invariant from 'tiny-invariant'
10
11
  import { GetFrameworkGeneric } from './frameworks'
11
12
 
@@ -407,16 +408,25 @@ export function createRouter<
407
408
  return router.routesById[id]
408
409
  },
409
410
  notify: (): void => {
410
- router.state = {
411
- ...router.state,
412
- isFetching:
413
- router.state.status === 'loading' ||
414
- router.state.matches.some((d) => d.isFetching),
415
- isPreloading: Object.values(router.matchCache).some(
416
- (d) =>
417
- d.match.isFetching &&
418
- !router.state.matches.find((dd) => dd.matchId === d.match.matchId),
419
- ),
411
+ const isFetching =
412
+ router.state.status === 'loading' ||
413
+ router.state.matches.some((d) => d.isFetching)
414
+
415
+ const isPreloading = Object.values(router.matchCache).some(
416
+ (d) =>
417
+ d.match.isFetching &&
418
+ !router.state.matches.find((dd) => dd.matchId === d.match.matchId),
419
+ )
420
+
421
+ if (
422
+ router.state.isFetching !== isFetching ||
423
+ router.state.isPreloading !== isPreloading
424
+ ) {
425
+ router.state = {
426
+ ...router.state,
427
+ isFetching,
428
+ isPreloading,
429
+ }
420
430
  }
421
431
 
422
432
  cascadeLoaderData(router.state.matches)
@@ -454,7 +464,7 @@ export function createRouter<
454
464
  Object.assign(match, dehydratedMatch)
455
465
  })
456
466
 
457
- router.loadMatches(matches)
467
+ matches.forEach((match) => match.__.validate())
458
468
 
459
469
  router.state = {
460
470
  ...router.state,
@@ -476,7 +486,9 @@ export function createRouter<
476
486
  router.__.commitLocation(next, true)
477
487
  }
478
488
 
479
- // router.load()
489
+ if (!router.state.matches.length) {
490
+ router.load()
491
+ }
480
492
 
481
493
  const unsub = router.history.listen((event) => {
482
494
  router.load(router.__.parseLocation(event.location, router.location))