@tanstack/react-router 0.0.1-beta.217 → 0.0.1-beta.218

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.217",
4
+ "version": "0.0.1-beta.218",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
@@ -42,7 +42,7 @@
42
42
  "@babel/runtime": "^7.16.7",
43
43
  "tiny-invariant": "^1.3.1",
44
44
  "tiny-warning": "^1.0.3",
45
- "@tanstack/history": "0.0.1-beta.217"
45
+ "@tanstack/history": "0.0.1-beta.218"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "rollup --config rollup.config.js"
package/src/Matches.tsx CHANGED
@@ -74,18 +74,20 @@ export function Match({ matches }: { matches: RouteMatch[] }) {
74
74
  ? React.Suspense
75
75
  : SafeFragment
76
76
 
77
- const errorComponent = React.useCallback(
78
- (props: any) => {
79
- return React.createElement(routeErrorComponent, {
80
- ...props,
81
- useMatch: route.useMatch,
82
- useRouteContext: route.useRouteContext,
83
- useSearch: route.useSearch,
84
- useParams: route.useParams,
85
- })
86
- },
87
- [route],
88
- )
77
+ const errorComponent = routeErrorComponent
78
+ ? React.useCallback(
79
+ (props: any) => {
80
+ return React.createElement(routeErrorComponent, {
81
+ ...props,
82
+ useMatch: route.useMatch,
83
+ useRouteContext: route.useRouteContext,
84
+ useSearch: route.useSearch,
85
+ useParams: route.useParams,
86
+ })
87
+ },
88
+ [route],
89
+ )
90
+ : undefined
89
91
 
90
92
  return (
91
93
  <matchesContext.Provider value={matches}>
@@ -97,15 +99,21 @@ export function Match({ matches }: { matches: RouteMatch[] }) {
97
99
  useParams: route.useParams,
98
100
  })}
99
101
  >
100
- <CatchBoundary
101
- resetKey={locationKey}
102
- errorComponent={errorComponent}
103
- onCatch={() => {
104
- warning(false, `Error in route match: ${match.id}`)
105
- }}
106
- >
107
- <MatchInner match={match} />
108
- </CatchBoundary>
102
+ {errorComponent ? (
103
+ <CatchBoundary
104
+ resetKey={locationKey}
105
+ errorComponent={errorComponent}
106
+ onCatch={() => {
107
+ warning(false, `Error in route match: ${match.id}`)
108
+ }}
109
+ >
110
+ <MatchInner match={match} />
111
+ </CatchBoundary>
112
+ ) : (
113
+ <SafeFragment>
114
+ <MatchInner match={match} />
115
+ </SafeFragment>
116
+ )}
109
117
  </ResolvedSuspenseBoundary>
110
118
  </matchesContext.Provider>
111
119
  )