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.
@@ -107,7 +107,9 @@ export interface RouterProps {
107
107
  navigationType?: NavigationType;
108
108
  navigator: Navigator;
109
109
  static?: boolean;
110
- future?: Partial<Pick<FutureConfig, "v7_relativeSplatPath">>;
110
+ future?: {
111
+ v7_relativeSplatPath?: boolean;
112
+ };
111
113
  }
112
114
  /**
113
115
  * Provides location context for the rest of the app.
@@ -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 Omit<NavigationContextObject, "future"> {
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-add6f8aa
2
+ * React Router v0.0.0-experimental-e960cf1a
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v0.0.0-experimental-add6f8aa
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 || matches[matches.length - 1].route.lazy !== 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.`) ;
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
- let {
492
- loaderData,
493
- errors: _errors
494
- } = dataRouterState;
495
- let needsToRunLoader = match.route.loader && loaderData[match.route.id] === undefined && (!_errors || _errors[match.route.id] === undefined);
496
- if (match.route.lazy || needsToRunLoader) {
497
- // We found the first route that's not ready to render (waiting on
498
- // lazy, or has a loader that hasn't run yet). Flag that we need to
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 " + "`v7_partialHydration`, use a `HydrateFallback` component instead") ;
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
- future: {
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