@tanstack/react-router 0.0.1-beta.223 → 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.
@@ -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 { state, subscribe, resetNextScrollRef } = useRouter()
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 (!resetNextScrollRef.current) {
144
+ if (!router.resetNextScroll) {
145
145
  return
146
146
  }
147
147
 
148
- resetNextScrollRef.current = true
148
+ router.resetNextScroll = true
149
149
 
150
150
  const getKey = options?.getKey || defaultGetKey
151
151