@tanstack/router-core 0.0.1-beta.34 → 0.0.1-beta.35

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.34",
4
+ "version": "0.0.1-beta.35",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
package/src/path.ts CHANGED
@@ -165,10 +165,10 @@ export function matchByPath(
165
165
  from: string,
166
166
  matchLocation: Pick<MatchLocation, 'to' | 'caseSensitive' | 'fuzzy'>,
167
167
  ): Record<string, string> | undefined {
168
- if (basepath && !from.startsWith(basepath)) {
168
+ if (!from.startsWith(basepath)) {
169
169
  return undefined
170
170
  }
171
- from = from.startsWith(basepath) ? from.substring(basepath.length) : from
171
+ from = basepath != '/' ? from.substring(basepath.length) : from
172
172
  const baseSegments = parsePathname(from)
173
173
  const to = `${matchLocation.to ?? '*'}`
174
174
  const routeSegments = parsePathname(to)
package/src/router.ts CHANGED
@@ -666,10 +666,8 @@ export function createRouter<
666
666
  ),
667
667
  )
668
668
  } catch (err: any) {
669
- if (err?.then) {
670
- await new Promise(() => {})
671
- }
672
- throw err
669
+ console.info(err)
670
+ invariant(false, `A route's beforeLoad middleware failed! 👆`)
673
671
  }
674
672
 
675
673
  router.notify()
@@ -712,10 +710,12 @@ export function createRouter<
712
710
  d.status = 'idle'
713
711
  d.error = undefined
714
712
  }
713
+
715
714
  const gc = Math.max(
716
715
  d.options.loaderGcMaxAge ?? router.options.defaultLoaderGcMaxAge ?? 0,
717
716
  d.options.loaderMaxAge ?? router.options.defaultLoaderMaxAge ?? 0,
718
717
  )
718
+
719
719
  if (gc > 0) {
720
720
  router.matchCache[d.matchId] = {
721
721
  gc: gc == Infinity ? Number.MAX_SAFE_INTEGER : now + gc,
@@ -857,6 +857,14 @@ export function createRouter<
857
857
  route.options.caseSensitive ?? router.options.caseSensitive,
858
858
  })
859
859
 
860
+ console.log(
861
+ router.basepath,
862
+ route.fullPath,
863
+ fuzzy,
864
+ pathname,
865
+ matchParams,
866
+ )
867
+
860
868
  if (matchParams) {
861
869
  let parsedParams
862
870
 
@@ -1032,6 +1040,7 @@ export function createRouter<
1032
1040
  if (!router.state.pending?.location) {
1033
1041
  return false
1034
1042
  }
1043
+
1035
1044
  return !!matchPathname(
1036
1045
  router.basepath,
1037
1046
  router.state.pending.location.pathname,