@tanstack/router-core 0.0.1-beta.52 → 0.0.1-beta.53
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/build/cjs/history.js +1 -2
- package/build/cjs/history.js.map +1 -1
- package/build/cjs/router.js.map +1 -1
- package/build/esm/index.js +1 -2
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +148 -148
- package/build/types/index.d.ts +1 -1
- package/build/umd/index.development.js +1 -2
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/history.ts +12 -2
- package/src/router.ts +7 -2
package/package.json
CHANGED
package/src/history.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// This implementation attempts to be more lightweight by
|
|
3
3
|
// making assumptions about the way TanStack Router works
|
|
4
4
|
|
|
5
|
+
import { match } from 'assert'
|
|
6
|
+
|
|
5
7
|
export interface RouterHistory {
|
|
6
8
|
location: RouterLocation
|
|
7
9
|
listen: (cb: () => void) => () => void
|
|
@@ -177,11 +179,19 @@ export function createMemoryHistory(
|
|
|
177
179
|
function parseLocation(href: string, state: any): RouterLocation {
|
|
178
180
|
let hashIndex = href.indexOf('#')
|
|
179
181
|
let searchIndex = href.indexOf('?')
|
|
180
|
-
const pathEnd = Math.min(hashIndex, searchIndex)
|
|
181
182
|
|
|
182
183
|
return {
|
|
183
184
|
href,
|
|
184
|
-
pathname:
|
|
185
|
+
pathname: href.substring(
|
|
186
|
+
0,
|
|
187
|
+
hashIndex > 0
|
|
188
|
+
? searchIndex > 0
|
|
189
|
+
? Math.min(hashIndex, searchIndex)
|
|
190
|
+
: hashIndex
|
|
191
|
+
: searchIndex > 0
|
|
192
|
+
? searchIndex
|
|
193
|
+
: href.length,
|
|
194
|
+
),
|
|
185
195
|
hash: hashIndex > -1 ? href.substring(hashIndex, searchIndex) : '',
|
|
186
196
|
search: searchIndex > -1 ? href.substring(searchIndex) : '',
|
|
187
197
|
state,
|
package/src/router.ts
CHANGED
|
@@ -820,7 +820,12 @@ export class Router<
|
|
|
820
820
|
}
|
|
821
821
|
}
|
|
822
822
|
|
|
823
|
-
invalidateRoute = async
|
|
823
|
+
invalidateRoute = async <
|
|
824
|
+
TFrom extends ValidFromPath<TAllRouteInfo> = '/',
|
|
825
|
+
TTo extends string = '.',
|
|
826
|
+
>(
|
|
827
|
+
opts: ToOptions<TAllRouteInfo, TFrom, TTo>,
|
|
828
|
+
) => {
|
|
824
829
|
const next = this.buildNext(opts)
|
|
825
830
|
const unloadedMatchIds = this.matchRoutes(next.pathname).map((d) => d.id)
|
|
826
831
|
|
|
@@ -1010,7 +1015,7 @@ export class Router<
|
|
|
1010
1015
|
) {
|
|
1011
1016
|
e.preventDefault()
|
|
1012
1017
|
if (pathIsEqual && !search && !hash) {
|
|
1013
|
-
this.invalidateRoute(nextOpts)
|
|
1018
|
+
this.invalidateRoute(nextOpts as any)
|
|
1014
1019
|
}
|
|
1015
1020
|
|
|
1016
1021
|
// All is well? Navigate!
|