@tanstack/react-router 0.0.1-beta.165 → 0.0.1-beta.166

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-beta.165",
4
+ "version": "0.0.1-beta.166",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
@@ -43,8 +43,8 @@
43
43
  "tiny-invariant": "^1.3.1",
44
44
  "tiny-warning": "^1.0.3",
45
45
  "@gisatcz/cross-package-react-context": "^0.2.0",
46
- "@tanstack/router-core": "0.0.1-beta.165",
47
- "@tanstack/react-store": "0.0.1-beta.165"
46
+ "@tanstack/router-core": "0.0.1-beta.166",
47
+ "@tanstack/react-store": "0.0.1-beta.166"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "rollup --config rollup.config.js"
package/src/index.tsx CHANGED
@@ -35,6 +35,7 @@ import {
35
35
  RouteById,
36
36
  ParseRoute,
37
37
  AllParams,
38
+ rootRouteId,
38
39
  } from '@tanstack/router-core'
39
40
 
40
41
  //
@@ -503,6 +504,7 @@ function Matches() {
503
504
  <matchIdsContext.Provider value={[undefined!, ...matchIds]}>
504
505
  <CatchBoundary
505
506
  errorComponent={ErrorComponent}
507
+ route={router.getRoute(rootRouteId)}
506
508
  onCatch={() => {
507
509
  warning(
508
510
  false,
@@ -795,7 +797,6 @@ function Match({ matchIds }: { matchIds: string[] }) {
795
797
  <matchIdsContext.Provider value={matchIds}>
796
798
  <ResolvedSuspenseBoundary
797
799
  fallback={React.createElement(PendingComponent, {
798
- useLoader: route.useLoader,
799
800
  useMatch: route.useMatch,
800
801
  useContext: route.useContext,
801
802
  useRouteContext: route.useRouteContext,
@@ -806,6 +807,7 @@ function Match({ matchIds }: { matchIds: string[] }) {
806
807
  <ResolvedCatchBoundary
807
808
  key={route.id}
808
809
  errorComponent={errorComponent}
810
+ route={route}
809
811
  onCatch={() => {
810
812
  warning(false, `Error in route match: ${matchId}`)
811
813
  }}
@@ -915,6 +917,7 @@ export function useHydrate() {
915
917
  class CatchBoundary extends React.Component<{
916
918
  children: any
917
919
  errorComponent: any
920
+ route: AnyRoute
918
921
  onCatch: (error: any, info: any) => void
919
922
  }> {
920
923
  state = {
@@ -942,6 +945,7 @@ class CatchBoundary extends React.Component<{
942
945
  function CatchBoundaryInner(props: {
943
946
  children: any
944
947
  errorComponent: any
948
+ route: AnyRoute
945
949
  errorState: { error: unknown; info: any }
946
950
  reset: () => void
947
951
  }) {
@@ -973,7 +977,14 @@ function CatchBoundaryInner(props: {
973
977
  }, [props.errorState.error])
974
978
 
975
979
  if (props.errorState.error && activeErrorState.error) {
976
- return React.createElement(errorComponent, activeErrorState)
980
+ return React.createElement(errorComponent, {
981
+ ...activeErrorState,
982
+ useMatch: props.route.useMatch,
983
+ useContext: props.route.useContext,
984
+ useRouteContext: props.route.useRouteContext,
985
+ useSearch: props.route.useSearch,
986
+ useParams: props.route.useParams,
987
+ })
977
988
  }
978
989
 
979
990
  return props.children