@tanstack/react-router 0.0.1-beta.30 → 0.0.1-beta.32

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/react-router",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-beta.30",
4
+ "version": "0.0.1-beta.32",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router/",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@babel/runtime": "^7.16.7",
44
- "@tanstack/router-core": "0.0.1-beta.30",
44
+ "@tanstack/router-core": "0.0.1-beta.31",
45
45
  "use-sync-external-store": "^1.2.0"
46
46
  },
47
47
  "devDependencies": {
package/src/index.tsx CHANGED
@@ -77,7 +77,7 @@ export function lazy(
77
77
  return finalComp
78
78
  }
79
79
 
80
- type LinkPropsOptions<
80
+ export type LinkPropsOptions<
81
81
  TAllRouteInfo extends AnyAllRouteInfo,
82
82
  TFrom extends ValidFromPath<TAllRouteInfo>,
83
83
  TTo extends string,
@@ -92,7 +92,7 @@ type LinkPropsOptions<
92
92
  | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)
93
93
  }
94
94
 
95
- type MakeMatchRouteOptions<
95
+ export type MakeMatchRouteOptions<
96
96
  TAllRouteInfo extends AnyAllRouteInfo,
97
97
  TFrom extends ValidFromPath<TAllRouteInfo>,
98
98
  TTo extends string,
@@ -109,14 +109,14 @@ type MakeMatchRouteOptions<
109
109
  ) => React.ReactNode)
110
110
  }
111
111
 
112
- type MakeLinkPropsOptions<
112
+ export type MakeLinkPropsOptions<
113
113
  TAllRouteInfo extends AnyAllRouteInfo,
114
114
  TFrom extends ValidFromPath<TAllRouteInfo>,
115
115
  TTo extends string,
116
116
  > = LinkPropsOptions<TAllRouteInfo, TFrom, TTo> &
117
117
  React.AnchorHTMLAttributes<HTMLAnchorElement>
118
118
 
119
- type MakeLinkOptions<
119
+ export type MakeLinkOptions<
120
120
  TAllRouteInfo extends AnyAllRouteInfo,
121
121
  TFrom extends ValidFromPath<TAllRouteInfo>,
122
122
  TTo extends string,
@@ -150,7 +150,6 @@ declare module '@tanstack/router-core' {
150
150
  useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(
151
151
  routeId: TId,
152
152
  ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>
153
- useNearestMatch: () => RouteMatch<TAllRouteInfo, RouteInfo>
154
153
  useMatch: <
155
154
  TId extends keyof TAllRouteInfo['routeInfoById'],
156
155
  TStrict extends boolean = true,
@@ -328,8 +327,9 @@ export function createReactRouter<
328
327
  const composeHandlers =
329
328
  (handlers: (undefined | ((e: any) => void))[]) =>
330
329
  (e: React.SyntheticEvent) => {
331
- e.persist()
330
+ if (e.persist) e.persist()
332
331
  handlers.forEach((handler) => {
332
+ if (e.defaultPrevented) return
333
333
  if (handler) handler(e)
334
334
  })
335
335
  }
@@ -758,7 +758,7 @@ export function usePrompt(message: string, when: boolean | any): void {
758
758
  unblock()
759
759
  transition.retry()
760
760
  } else {
761
- router.location.pathname = window.location.pathname
761
+ router.state.location.pathname = window.location.pathname
762
762
  }
763
763
  })
764
764