@tanstack/react-router 1.15.23 → 1.16.2
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/dist/cjs/link.cjs.map +1 -1
- package/dist/cjs/path.cjs +2 -2
- package/dist/cjs/path.cjs.map +1 -1
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/path.js +2 -2
- package/dist/esm/path.js.map +1 -1
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/link.tsx +12 -10
- package/src/path.ts +3 -2
- package/src/router.ts +1 -1
- package/src/utils.ts +8 -5
package/src/path.ts
CHANGED
|
@@ -173,7 +173,7 @@ export function matchPathname(
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
export function removeBasepath(basepath: string, pathname: string) {
|
|
176
|
-
return basepath != '/' ? pathname.
|
|
176
|
+
return basepath != '/' ? pathname.replace(basepath, '') : pathname
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
export function matchByPath(
|
|
@@ -184,7 +184,8 @@ export function matchByPath(
|
|
|
184
184
|
// Remove the base path from the pathname
|
|
185
185
|
from = removeBasepath(basepath, from)
|
|
186
186
|
// Default to to $ (wildcard)
|
|
187
|
-
const to = `${matchLocation.to ?? '$'}`
|
|
187
|
+
const to = removeBasepath(basepath, `${matchLocation.to ?? '$'}`)
|
|
188
|
+
|
|
188
189
|
// Parse the from and to
|
|
189
190
|
const baseSegments = parsePathname(from)
|
|
190
191
|
const routeSegments = parsePathname(to)
|
package/src/router.ts
CHANGED
|
@@ -841,7 +841,7 @@ export class Router<
|
|
|
841
841
|
let nextParams =
|
|
842
842
|
(dest.params ?? true) === true
|
|
843
843
|
? prevParams
|
|
844
|
-
: {...prevParams, ...functionalUpdate(dest.params!, prevParams)}
|
|
844
|
+
: { ...prevParams, ...functionalUpdate(dest.params!, prevParams) }
|
|
845
845
|
|
|
846
846
|
if (nextParams) {
|
|
847
847
|
matches
|
package/src/utils.ts
CHANGED
|
@@ -34,13 +34,16 @@ export type DeepPartial<T> = T extends object
|
|
|
34
34
|
}
|
|
35
35
|
: T
|
|
36
36
|
|
|
37
|
-
export type MakeDifferenceOptional<T, U> = Omit<U, keyof T> &
|
|
37
|
+
export type MakeDifferenceOptional<T, U> = Omit<U, keyof T> &
|
|
38
|
+
Partial<Pick<U, keyof T & keyof U>> &
|
|
39
|
+
PickRequired<Omit<U, keyof PickRequired<T>>>
|
|
38
40
|
|
|
39
41
|
// from https://stackoverflow.com/a/53955431
|
|
40
|
-
export type IsUnion<T, U extends T = T> =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
export type IsUnion<T, U extends T = T> = (
|
|
43
|
+
T extends any ? (U extends T ? false : true) : never
|
|
44
|
+
) extends false
|
|
45
|
+
? false
|
|
46
|
+
: true
|
|
44
47
|
|
|
45
48
|
// type Compute<T> = { [K in keyof T]: T[K] } | never
|
|
46
49
|
|