@tanstack/react-router 0.0.1-beta.222 → 0.0.1-beta.224
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/Matches.js.map +1 -1
- package/build/cjs/RouterProvider.js +56 -955
- package/build/cjs/RouterProvider.js.map +1 -1
- package/build/cjs/fileRoute.js.map +1 -1
- package/build/cjs/route.js.map +1 -1
- package/build/cjs/router.js +953 -39
- package/build/cjs/router.js.map +1 -1
- package/build/cjs/scroll-restoration.js +5 -9
- package/build/cjs/scroll-restoration.js.map +1 -1
- package/build/cjs/useSearch.js.map +1 -1
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +895 -889
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +369 -363
- package/build/types/Matches.d.ts +25 -2
- package/build/types/RouterProvider.d.ts +4 -45
- package/build/types/fileRoute.d.ts +5 -5
- package/build/types/route.d.ts +3 -1
- package/build/types/router.d.ts +50 -5
- package/build/umd/index.development.js +895 -889
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/Matches.tsx +38 -2
- package/src/RouterProvider.tsx +58 -1342
- package/src/fileRoute.ts +1 -1
- package/src/route.ts +24 -1
- package/src/router.ts +1320 -45
- package/src/scroll-restoration.tsx +5 -5
- package/src/useSearch.tsx +1 -1
- package/src/utils.ts +1 -1
|
@@ -34,7 +34,7 @@ export type ScrollRestorationOptions = {
|
|
|
34
34
|
const defaultGetKey = (location: ParsedLocation) => location.state.key!
|
|
35
35
|
|
|
36
36
|
export function useScrollRestoration(options?: ScrollRestorationOptions) {
|
|
37
|
-
const
|
|
37
|
+
const router = useRouter()
|
|
38
38
|
|
|
39
39
|
useLayoutEffect(() => {
|
|
40
40
|
const getKey = options?.getKey || defaultGetKey
|
|
@@ -108,7 +108,7 @@ export function useScrollRestoration(options?: ScrollRestorationOptions) {
|
|
|
108
108
|
document.addEventListener('scroll', onScroll, true)
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
const unsubOnBeforeLoad = subscribe('onBeforeLoad', (event) => {
|
|
111
|
+
const unsubOnBeforeLoad = router.subscribe('onBeforeLoad', (event) => {
|
|
112
112
|
if (event.pathChanged) {
|
|
113
113
|
const restoreKey = getKey(event.fromLocation)
|
|
114
114
|
for (const elementSelector in cache.state.next) {
|
|
@@ -139,13 +139,13 @@ export function useScrollRestoration(options?: ScrollRestorationOptions) {
|
|
|
139
139
|
}
|
|
140
140
|
})
|
|
141
141
|
|
|
142
|
-
const unsubOnResolved = subscribe('onResolved', (event) => {
|
|
142
|
+
const unsubOnResolved = router.subscribe('onResolved', (event) => {
|
|
143
143
|
if (event.pathChanged) {
|
|
144
|
-
if (!
|
|
144
|
+
if (!router.resetNextScroll) {
|
|
145
145
|
return
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
router.resetNextScroll = true
|
|
149
149
|
|
|
150
150
|
const getKey = options?.getKey || defaultGetKey
|
|
151
151
|
|
package/src/useSearch.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyRoute } from './route'
|
|
2
2
|
import { RouteIds, RouteById } from './routeInfo'
|
|
3
3
|
import { RegisteredRouter } from './router'
|
|
4
|
-
import { RouteMatch } from './
|
|
4
|
+
import { RouteMatch } from './Matches'
|
|
5
5
|
import { useMatch } from './Matches'
|
|
6
6
|
import { StrictOrFrom } from './utils'
|
|
7
7
|
|
package/src/utils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { useMatch } from './Matches'
|
|
3
|
-
import { RouteMatch } from './
|
|
3
|
+
import { RouteMatch } from './Matches'
|
|
4
4
|
import { AnyRoute } from './route'
|
|
5
5
|
import { ParseRoute, RouteIds, RoutesById, RouteById } from './routeInfo'
|
|
6
6
|
import { RegisteredRouter } from './router'
|