react-router 0.0.0-experimental-8f9ef191 → 0.0.0-experimental-9463fb5e

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # `react-router`
2
2
 
3
+ ## 6.20.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Revert the `useResolvedPath` fix for splat routes due to a large number of applications that were relying on the buggy behavior (see https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329). We plan to re-introduce this fix behind a future flag in the next minor version. ([#11078](https://github.com/remix-run/react-router/pull/11078))
8
+ - Updated dependencies:
9
+ - `@remix-run/router@1.13.1`
10
+
11
+ ## 6.20.0
12
+
13
+ ### Minor Changes
14
+
15
+ - Export the `PathParam` type from the public API ([#10719](https://github.com/remix-run/react-router/pull/10719))
16
+
17
+ ### Patch Changes
18
+
19
+ - Fix bug with `resolveTo` in splat routes ([#11045](https://github.com/remix-run/react-router/pull/11045))
20
+ - This is a follow up to [#10983](https://github.com/remix-run/react-router/pull/10983) to handle the few other code paths using `getPathContributingMatches`
21
+ - This removes the `UNSAFE_getPathContributingMatches` export from `@remix-run/router` since we no longer need this in the `react-router`/`react-router-dom` layers
22
+ - Updated dependencies:
23
+ - `@remix-run/router@1.13.0`
24
+
3
25
  ## 6.19.0
4
26
 
5
27
  ### Minor Changes
@@ -122,7 +144,7 @@
122
144
 
123
145
  ## 6.12.1
124
146
 
125
- > **Warning**
147
+ > [!WARNING]
126
148
  > Please use version `6.13.0` or later instead of `6.12.1`. This version suffers from a `webpack`/`terser` minification issue resulting in invalid minified code in your resulting production bundles which can cause issues in your application. See [#10579](https://github.com/remix-run/react-router/issues/10579) for more details.
127
149
 
128
150
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v0.0.0-experimental-8f9ef191
2
+ * React Router v0.0.0-experimental-9463fb5e
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -204,6 +204,7 @@ function useNavigateUnstable() {
204
204
  let dataRouterContext = React.useContext(DataRouterContext);
205
205
  let {
206
206
  basename,
207
+ future,
207
208
  navigator
208
209
  } = React.useContext(NavigationContext);
209
210
  let {
@@ -212,7 +213,7 @@ function useNavigateUnstable() {
212
213
  let {
213
214
  pathname: locationPathname
214
215
  } = useLocation();
215
- let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches));
216
+ let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));
216
217
  let activeRef = React.useRef(false);
217
218
  useIsomorphicLayoutEffect(() => {
218
219
  activeRef.current = true;
@@ -295,13 +296,16 @@ function useResolvedPath(to, _temp2) {
295
296
  let {
296
297
  relative
297
298
  } = _temp2 === void 0 ? {} : _temp2;
299
+ let {
300
+ future
301
+ } = React.useContext(NavigationContext);
298
302
  let {
299
303
  matches
300
304
  } = React.useContext(RouteContext);
301
305
  let {
302
306
  pathname: locationPathname
303
307
  } = useLocation();
304
- let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches));
308
+ let routePathnamesJson = JSON.stringify(UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));
305
309
  return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
306
310
  }
307
311
 
@@ -472,7 +476,7 @@ class RenderErrorBoundary extends React.Component {
472
476
  // this because the error provided from the app state may be cleared without
473
477
  // the location changing.
474
478
  return {
475
- error: props.error || state.error,
479
+ error: props.error !== undefined ? props.error : state.error,
476
480
  location: state.location,
477
481
  revalidation: props.revalidation || state.revalidation
478
482
  };
@@ -481,7 +485,7 @@ class RenderErrorBoundary extends React.Component {
481
485
  console.error("React Router caught the following error during render", error, errorInfo);
482
486
  }
483
487
  render() {
484
- return this.state.error ? /*#__PURE__*/React.createElement(RouteContext.Provider, {
488
+ return this.state.error !== undefined ? /*#__PURE__*/React.createElement(RouteContext.Provider, {
485
489
  value: this.props.routeContext
486
490
  }, /*#__PURE__*/React.createElement(RouteErrorContext.Provider, {
487
491
  value: this.state.error,
@@ -569,7 +573,7 @@ function _renderMatches(matches, parentMatches, dataRouterState, future) {
569
573
  let errorElement = null;
570
574
  let hydrateFallbackElement = null;
571
575
  if (dataRouterState) {
572
- error = errors && match.route.id ? errors[match.route.id] : null;
576
+ error = errors && match.route.id ? errors[match.route.id] : undefined;
573
577
  errorElement = match.route.errorElement || defaultErrorElement;
574
578
  if (renderFallback) {
575
579
  if (fallbackIndex < 0 && index === 0) {
@@ -759,7 +763,7 @@ function useRouteError() {
759
763
 
760
764
  // If this was a render error, we put it in a RouteError context inside
761
765
  // of RenderErrorBoundary
762
- if (error) {
766
+ if (error !== undefined) {
763
767
  return error;
764
768
  }
765
769
 
@@ -961,7 +965,10 @@ function RouterProvider(_ref) {
961
965
  router,
962
966
  navigator,
963
967
  static: false,
964
- basename
968
+ basename,
969
+ future: {
970
+ v7_relativeSplatPath: router.future.v7_relativeSplatPath
971
+ }
965
972
  }), [router, navigator, basename]);
966
973
 
967
974
  // The fragment and {null} here are important! We need them to keep React 18's
@@ -1031,7 +1038,8 @@ function MemoryRouter(_ref3) {
1031
1038
  children: children,
1032
1039
  location: state.location,
1033
1040
  navigationType: state.action,
1034
- navigator: history
1041
+ navigator: history,
1042
+ future: future
1035
1043
  });
1036
1044
  }
1037
1045
  /**
@@ -1053,7 +1061,11 @@ function Navigate(_ref4) {
1053
1061
  !useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of
1054
1062
  // the router loaded. We can help them understand how to avoid that.
1055
1063
  "<Navigate> may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
1056
- process.env.NODE_ENV !== "production" ? UNSAFE_warning(!React.useContext(NavigationContext).static, "<Navigate> must not be used on the initial render in a <StaticRouter>. " + "This is a no-op, but you should modify your code so the <Navigate> is " + "only ever rendered in response to some user interaction or state change.") : void 0;
1064
+ let {
1065
+ future,
1066
+ static: isStatic
1067
+ } = React.useContext(NavigationContext);
1068
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(!isStatic, "<Navigate> must not be used on the initial render in a <StaticRouter>. " + "This is a no-op, but you should modify your code so the <Navigate> is " + "only ever rendered in response to some user interaction or state change.") : void 0;
1057
1069
  let {
1058
1070
  matches
1059
1071
  } = React.useContext(RouteContext);
@@ -1064,7 +1076,7 @@ function Navigate(_ref4) {
1064
1076
 
1065
1077
  // Resolve the path outside of the effect so that when effects run twice in
1066
1078
  // StrictMode they navigate to the same place
1067
- let path = resolveTo(to, UNSAFE_getResolveToMatches(matches), locationPathname, relative === "path");
1079
+ let path = resolveTo(to, UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath), locationPathname, relative === "path");
1068
1080
  let jsonPath = JSON.stringify(path);
1069
1081
  React.useEffect(() => navigate(JSON.parse(jsonPath), {
1070
1082
  replace,
@@ -1105,7 +1117,8 @@ function Router(_ref5) {
1105
1117
  location: locationProp,
1106
1118
  navigationType = Action.Pop,
1107
1119
  navigator,
1108
- static: staticProp = false
1120
+ static: staticProp = false,
1121
+ future
1109
1122
  } = _ref5;
1110
1123
  !!useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "You cannot render a <Router> inside another <Router>." + " You should never have more than one in your app.") : UNSAFE_invariant(false) : void 0;
1111
1124
 
@@ -1115,8 +1128,11 @@ function Router(_ref5) {
1115
1128
  let navigationContext = React.useMemo(() => ({
1116
1129
  basename,
1117
1130
  navigator,
1118
- static: staticProp
1119
- }), [basename, navigator, staticProp]);
1131
+ static: staticProp,
1132
+ future: _extends({
1133
+ v7_relativeSplatPath: false
1134
+ }, future)
1135
+ }), [basename, future, navigator, staticProp]);
1120
1136
  if (typeof locationProp === "string") {
1121
1137
  locationProp = parsePath(locationProp);
1122
1138
  }