@tanstack/react-router 0.0.1-beta.80 → 0.0.1-beta.81

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/src/index.tsx CHANGED
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react'
2
2
 
3
3
  import {
4
- Route,
5
4
  RegisteredRoutesInfo,
6
5
  RegisteredRouter,
7
6
  RouterStore,
@@ -572,29 +571,6 @@ function SubOutlet({
572
571
 
573
572
  const defaultPending = React.useCallback(() => null, [])
574
573
 
575
- const Inner = React.useCallback((props: { match: RouteMatch }): any => {
576
- if (props.match.state.status === 'error') {
577
- throw props.match.state.error
578
- }
579
-
580
- if (props.match.state.status === 'success') {
581
- return React.createElement(
582
- (props.match.component as any) ??
583
- router.options.defaultComponent ??
584
- Outlet,
585
- )
586
- }
587
-
588
- if (props.match.state.status === 'pending') {
589
- throw props.match.__loadPromise
590
- }
591
-
592
- invariant(
593
- false,
594
- 'Idle routeMatch status encountered during rendering! You should never see this. File an issue!',
595
- )
596
- }, [])
597
-
598
574
  const PendingComponent = (match.pendingComponent ??
599
575
  router.options.defaultPendingComponent ??
600
576
  defaultPending) as any
@@ -623,6 +599,31 @@ function SubOutlet({
623
599
  )
624
600
  }
625
601
 
602
+ function Inner(props: { match: RouteMatch }): any {
603
+ const router = useRouterContext()
604
+
605
+ if (props.match.state.status === 'error') {
606
+ throw props.match.state.error
607
+ }
608
+
609
+ if (props.match.state.status === 'success') {
610
+ return React.createElement(
611
+ (props.match.component as any) ??
612
+ router.options.defaultComponent ??
613
+ Outlet,
614
+ )
615
+ }
616
+
617
+ if (props.match.state.status === 'pending') {
618
+ throw props.match.__loadPromise
619
+ }
620
+
621
+ invariant(
622
+ false,
623
+ 'Idle routeMatch status encountered during rendering! You should never see this. File an issue!',
624
+ )
625
+ }
626
+
626
627
  function SafeFragment(props: any) {
627
628
  return <>{props.children}</>
628
629
  }