react-router 6.16.0-pre.0 → 6.16.0-pre.1

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.
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import type { Blocker, BlockerFunction, Location, ParamParseKey, Params, Path, PathMatch, PathPattern, RelativeRoutingType, Router as RemixRouter, RevalidationState, To } from "@remix-run/router";
2
+ import type { Blocker, BlockerFunction, Location, ParamParseKey, Params, Path, PathMatch, PathPattern, RelativeRoutingType, Router as RemixRouter, RevalidationState, To, UIMatch } from "@remix-run/router";
3
3
  import { Action as NavigationType } from "@remix-run/router";
4
4
  import type { NavigateOptions, RouteContextObject, RouteMatch, RouteObject } from "./context";
5
5
  /**
@@ -116,7 +116,7 @@ export declare class RenderErrorBoundary extends React.Component<RenderErrorBoun
116
116
  };
117
117
  static getDerivedStateFromProps(props: RenderErrorBoundaryProps, state: RenderErrorBoundaryState): {
118
118
  error: any;
119
- location: Location;
119
+ location: Location<any>;
120
120
  revalidation: RevalidationState;
121
121
  };
122
122
  componentDidCatch(error: any, errorInfo: any): void;
@@ -144,13 +144,7 @@ export declare function useRevalidator(): {
144
144
  * Returns the active route matches, useful for accessing loaderData for
145
145
  * parent/child routes or the route "handle" property
146
146
  */
147
- export declare function useMatches(): {
148
- id: string;
149
- pathname: string;
150
- params: Params<string>;
151
- data: unknown;
152
- handle: unknown;
153
- }[];
147
+ export declare function useMatches(): UIMatch[];
154
148
  /**
155
149
  * Returns the loader data for the nearest ancestor Route loader
156
150
  */
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v6.16.0-pre.0
2
+ * React Router v6.16.0-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v6.16.0-pre.0
2
+ * React Router v6.16.0-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -9,7 +9,7 @@
9
9
  * @license MIT
10
10
  */
11
11
  import * as React from 'react';
12
- import { UNSAFE_invariant, joinPaths, matchPath, UNSAFE_getPathContributingMatches, UNSAFE_warning, resolveTo, parsePath, matchRoutes, Action, stripBasename, IDLE_BLOCKER, isRouteErrorResponse, createMemoryHistory, AbortedDeferredError, createRouter } from '@remix-run/router';
12
+ import { UNSAFE_invariant, joinPaths, matchPath, UNSAFE_getPathContributingMatches, UNSAFE_warning, resolveTo, parsePath, matchRoutes, Action, UNSAFE_convertRouteMatchToUiMatch, stripBasename, IDLE_BLOCKER, isRouteErrorResponse, createMemoryHistory, AbortedDeferredError, createRouter } from '@remix-run/router';
13
13
  export { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, resolvePath } from '@remix-run/router';
14
14
 
15
15
  const DataRouterContext = /*#__PURE__*/React.createContext(null);
@@ -603,22 +603,7 @@ function useMatches() {
603
603
  matches,
604
604
  loaderData
605
605
  } = useDataRouterState(DataRouterStateHook.UseMatches);
606
- return React.useMemo(() => matches.map(match => {
607
- let {
608
- pathname,
609
- params
610
- } = match;
611
- // Note: This structure matches that created by createUseMatchesMatch
612
- // in the @remix-run/router , so if you change this please also change
613
- // that :) Eventually we'll DRY this up
614
- return {
615
- id: match.route.id,
616
- pathname,
617
- params,
618
- data: loaderData[match.route.id],
619
- handle: match.route.handle
620
- };
621
- }), [matches, loaderData]);
606
+ return React.useMemo(() => matches.map(m => UNSAFE_convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);
622
607
  }
623
608
  /**
624
609
  * Returns the loader data for the nearest ancestor Route loader