react-router 0.0.0-experimental-add6f8aa → 0.0.0-experimental-e960cf1a
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 +7 -166
- package/dist/index.d.ts +3 -2
- package/dist/index.js +21 -27
- package/dist/index.js.map +1 -1
- package/dist/lib/components.d.ts +3 -1
- package/dist/lib/context.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/react-router.development.js +21 -27
- package/dist/react-router.development.js.map +1 -1
- package/dist/react-router.production.min.js +2 -2
- package/dist/react-router.production.min.js.map +1 -1
- package/dist/umd/react-router.development.js +21 -27
- package/dist/umd/react-router.development.js.map +1 -1
- package/dist/umd/react-router.production.min.js +2 -2
- package/dist/umd/react-router.production.min.js.map +1 -1
- package/package.json +2 -2
package/dist/lib/components.d.ts
CHANGED
|
@@ -107,7 +107,9 @@ export interface RouterProps {
|
|
|
107
107
|
navigationType?: NavigationType;
|
|
108
108
|
navigator: Navigator;
|
|
109
109
|
static?: boolean;
|
|
110
|
-
future?:
|
|
110
|
+
future?: {
|
|
111
|
+
v7_relativeSplatPath?: boolean;
|
|
112
|
+
};
|
|
111
113
|
}
|
|
112
114
|
/**
|
|
113
115
|
* Provides location context for the rest of the app.
|
package/dist/lib/context.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export interface RouteMatch<ParamKey extends string = string, RouteObjectType ex
|
|
|
47
47
|
}
|
|
48
48
|
export interface DataRouteMatch extends RouteMatch<string, DataRouteObject> {
|
|
49
49
|
}
|
|
50
|
-
export interface DataRouterContextObject extends
|
|
50
|
+
export interface DataRouterContextObject extends NavigationContextObject {
|
|
51
51
|
router: Router;
|
|
52
52
|
staticContext?: StaticHandlerContext;
|
|
53
53
|
}
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router v0.0.0-experimental-
|
|
2
|
+
* React Router v0.0.0-experimental-e960cf1a
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -329,7 +329,7 @@ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
|
|
|
329
329
|
});
|
|
330
330
|
{
|
|
331
331
|
UNSAFE_warning(parentRoute || matches != null, `No routes matched location "${location.pathname}${location.search}${location.hash}" `) ;
|
|
332
|
-
UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined
|
|
332
|
+
UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined, `Matched leaf route at location "${location.pathname}${location.search}${location.hash}" ` + `does not have an element or Component. This means it will render an <Outlet /> with a ` + `null value by default resulting in an "empty" page.`) ;
|
|
333
333
|
}
|
|
334
334
|
let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {
|
|
335
335
|
params: Object.assign({}, parentParams, match.params),
|
|
@@ -487,24 +487,17 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
|
|
|
487
487
|
if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
|
|
488
488
|
fallbackIndex = i;
|
|
489
489
|
}
|
|
490
|
-
if (match.route.id) {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
// render a fallback and render up until the appropriate fallback
|
|
500
|
-
renderFallback = true;
|
|
501
|
-
if (fallbackIndex >= 0) {
|
|
502
|
-
renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
|
|
503
|
-
} else {
|
|
504
|
-
renderedMatches = [renderedMatches[0]];
|
|
505
|
-
}
|
|
506
|
-
break;
|
|
490
|
+
if (match.route.loader && match.route.id && dataRouterState.loaderData[match.route.id] === undefined && (!dataRouterState.errors || dataRouterState.errors[match.route.id] === undefined)) {
|
|
491
|
+
// We found the first route without data/errors which means it's loader
|
|
492
|
+
// still needs to run. Flag that we need to render a fallback and
|
|
493
|
+
// render up until the appropriate fallback
|
|
494
|
+
renderFallback = true;
|
|
495
|
+
if (fallbackIndex >= 0) {
|
|
496
|
+
renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
|
|
497
|
+
} else {
|
|
498
|
+
renderedMatches = [renderedMatches[0]];
|
|
507
499
|
}
|
|
500
|
+
break;
|
|
508
501
|
}
|
|
509
502
|
}
|
|
510
503
|
}
|
|
@@ -858,7 +851,7 @@ function RouterProvider({
|
|
|
858
851
|
// pick up on any render-driven redirects/navigations (useEffect/<Navigate>)
|
|
859
852
|
React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
|
|
860
853
|
React.useEffect(() => {
|
|
861
|
-
UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, "`<RouterProvider fallbackElement>` is deprecated when using
|
|
854
|
+
UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, "`<RouterProvider fallbackElement>` is deprecated when using `v7_partialHydration`") ;
|
|
862
855
|
// Only log this once on initial mount
|
|
863
856
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
864
857
|
}, []);
|
|
@@ -883,7 +876,10 @@ function RouterProvider({
|
|
|
883
876
|
router,
|
|
884
877
|
navigator,
|
|
885
878
|
static: false,
|
|
886
|
-
basename
|
|
879
|
+
basename,
|
|
880
|
+
future: {
|
|
881
|
+
v7_relativeSplatPath: router.future.v7_relativeSplatPath
|
|
882
|
+
}
|
|
887
883
|
}), [router, navigator, basename]);
|
|
888
884
|
// The fragment and {null} here are important! We need them to keep React 18's
|
|
889
885
|
// useId happy when we are server-rendering since we may have a <script> here
|
|
@@ -899,11 +895,8 @@ function RouterProvider({
|
|
|
899
895
|
basename: basename,
|
|
900
896
|
location: state.location,
|
|
901
897
|
navigationType: state.historyAction,
|
|
902
|
-
navigator: navigator
|
|
903
|
-
|
|
904
|
-
v7_relativeSplatPath: router.future.v7_relativeSplatPath
|
|
905
|
-
}
|
|
906
|
-
}, state.initialized || router.future.v7_partialHydration ? /*#__PURE__*/React.createElement(DataRoutes, {
|
|
898
|
+
navigator: navigator
|
|
899
|
+
}, state.initialized ? /*#__PURE__*/React.createElement(DataRoutes, {
|
|
907
900
|
routes: router.routes,
|
|
908
901
|
future: router.future,
|
|
909
902
|
state: state
|
|
@@ -1323,7 +1316,8 @@ function createMemoryRouter(routes, opts) {
|
|
|
1323
1316
|
}),
|
|
1324
1317
|
hydrationData: opts?.hydrationData,
|
|
1325
1318
|
routes,
|
|
1326
|
-
mapRouteProperties
|
|
1319
|
+
mapRouteProperties,
|
|
1320
|
+
unstable_dataStrategy: opts?.unstable_dataStrategy
|
|
1327
1321
|
}).initialize();
|
|
1328
1322
|
}
|
|
1329
1323
|
|