@tanstack/react-router 1.2.3 → 1.2.5

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": "1.2.3",
4
+ "version": "1.2.5",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
@@ -44,7 +44,7 @@
44
44
  "@tanstack/store": "^0.1.3",
45
45
  "tiny-invariant": "^1.3.1",
46
46
  "tiny-warning": "^1.0.3",
47
- "@tanstack/history": "1.2.3"
47
+ "@tanstack/history": "1.2.5"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "rollup --config rollup.config.js"
package/src/route.ts CHANGED
@@ -33,8 +33,6 @@ export type AnyContext = {}
33
33
 
34
34
  export interface RouteContext {}
35
35
 
36
- export interface RouteMeta {}
37
-
38
36
  export type PreloadableObj = { preload?: () => Promise<void> }
39
37
 
40
38
  export type RoutePathOptions<TCustomId, TPath> =
@@ -48,14 +46,6 @@ export type RoutePathOptions<TCustomId, TPath> =
48
46
  export type RoutePathOptionsIntersection<TCustomId, TPath> =
49
47
  UnionToIntersection<RoutePathOptions<TCustomId, TPath>>
50
48
 
51
- export type MetaOptions = keyof PickRequired<RouteMeta> extends never
52
- ? {
53
- meta?: RouteMeta
54
- }
55
- : {
56
- meta: RouteMeta
57
- }
58
-
59
49
  export type RouteOptions<
60
50
  TParentRoute extends AnyRoute = AnyRoute,
61
51
  TCustomId extends string = string,
@@ -188,7 +178,7 @@ type BeforeLoadFn<
188
178
 
189
179
  export type UpdatableRouteOptions<
190
180
  TFullSearchSchema extends Record<string, any>,
191
- > = MetaOptions & {
181
+ > = {
192
182
  // test?: (args: TAllContext) => void
193
183
  // If true, this route will be matched as case-sensitive
194
184
  caseSensitive?: boolean
package/src/router.ts CHANGED
@@ -259,12 +259,18 @@ export class Router<
259
259
  startReactTransition: (fn: () => void) => void = (fn) => fn()
260
260
 
261
261
  update = (newOptions: RouterConstructorOptions<TRouteTree, TDehydrated>) => {
262
+ const previousOptions = this.options
262
263
  this.options = {
263
264
  ...this.options,
264
265
  ...newOptions,
265
266
  }
266
267
 
267
- this.basepath = `/${trimPath(newOptions.basepath ?? '') ?? ''}`
268
+ if (
269
+ !this.basepath ||
270
+ (newOptions.basepath && newOptions.basepath !== previousOptions.basepath)
271
+ ) {
272
+ this.basepath = `/${trimPath(newOptions.basepath ?? '') ?? ''}`
273
+ }
268
274
 
269
275
  if (
270
276
  !this.history ||
@@ -274,7 +280,9 @@ export class Router<
274
280
  this.options.history ??
275
281
  (typeof document !== 'undefined'
276
282
  ? createBrowserHistory()
277
- : createMemoryHistory())
283
+ : createMemoryHistory({
284
+ initialEntries: [this.options.basepath || '/'],
285
+ }))
278
286
  this.latestLocation = this.parseLocation()
279
287
  }
280
288