react-router 7.8.0 → 7.8.1-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.
- package/CHANGELOG.md +19 -0
- package/dist/development/{chunk-VC6RBZTR.js → chunk-3JDDYHAM.js} +130 -130
- package/dist/development/{chunk-EVX7OBGB.js → chunk-5556IWOV.js} +98 -83
- package/dist/development/{chunk-ZYFC6VSF.mjs → chunk-74543KUN.mjs} +62 -47
- package/dist/{production/chunk-XPGU3ZMH.mjs → development/chunk-NL6TORMN.mjs} +147 -33
- package/dist/development/dom-export.js +3 -3
- package/dist/development/dom-export.mjs +3 -3
- package/dist/{production/index-react-server-client-DXb0OgpJ.d.mts → development/index-react-server-client-11fLy3qB.d.mts} +1 -1
- package/dist/development/{index-react-server-client-CMphySRb.d.ts → index-react-server-client-BQ6FxdA_.d.ts} +1 -1
- package/dist/development/index-react-server-client.d.mts +2 -2
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +38 -1
- package/dist/development/index-react-server.d.ts +38 -1
- package/dist/development/index-react-server.js +56 -45
- package/dist/development/index-react-server.mjs +56 -46
- package/dist/development/index.d.mts +42 -4
- package/dist/development/index.d.ts +42 -4
- package/dist/development/index.js +242 -128
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.d.mts +6 -3
- package/dist/development/lib/types/internal.d.ts +6 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{route-data-CpB5xtMm.d.mts → route-data-CNjObrhZ.d.mts} +1 -1
- package/dist/development/{routeModules-qBivMBjd.d.ts → routeModules-C3oqzPpI.d.ts} +1 -1
- package/dist/production/{chunk-BOD6JCOU.js → chunk-3OSMCWIR.js} +98 -83
- package/dist/production/{chunk-SIHON65V.mjs → chunk-HVGIEXH6.mjs} +62 -47
- package/dist/{development/chunk-HZX6U7MI.mjs → production/chunk-J44BHEXU.mjs} +147 -33
- package/dist/production/{chunk-O6DRQPUD.js → chunk-OE6UW5JS.js} +130 -130
- package/dist/production/dom-export.js +3 -3
- package/dist/production/dom-export.mjs +3 -3
- package/dist/{development/index-react-server-client-DXb0OgpJ.d.mts → production/index-react-server-client-11fLy3qB.d.mts} +1 -1
- package/dist/production/{index-react-server-client-CMphySRb.d.ts → index-react-server-client-BQ6FxdA_.d.ts} +1 -1
- package/dist/production/index-react-server-client.d.mts +2 -2
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +38 -1
- package/dist/production/index-react-server.d.ts +38 -1
- package/dist/production/index-react-server.js +56 -45
- package/dist/production/index-react-server.mjs +56 -46
- package/dist/production/index.d.mts +42 -4
- package/dist/production/index.d.ts +42 -4
- package/dist/production/index.js +242 -128
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.d.mts +6 -3
- package/dist/production/lib/types/internal.d.ts +6 -3
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{route-data-CpB5xtMm.d.mts → route-data-CNjObrhZ.d.mts} +1 -1
- package/dist/production/{routeModules-qBivMBjd.d.ts → routeModules-C3oqzPpI.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as Router, e as RouteModules, D as DataStrategyFunction, T as To, f as NavigateOptions, B as BlockerFunction, g as Blocker, h as SerializeFrom, i as RelativeRoutingType, a as Location, j as ParamParseKey, k as Path, l as PathPattern, m as PathMatch, U as UIMatch, n as Navigation, A as Action, o as Params, p as RouteObject, I as InitialEntry, H as HydrationState, q as IndexRouteObject, r as LoaderFunction, s as ActionFunction, t as MetaFunction, v as LinksFunction, w as NonIndexRouteObject, x as AppLoadContext, y as unstable_RouterContextProvider, z as MiddlewareEnabled, E as Equal,
|
|
2
|
-
export {
|
|
3
|
-
import { A as AssetsManifest, E as EntryContext, F as FutureConfig, R as RouteComponentType, H as HydrateFallbackType, a as ErrorBoundaryType, S as ServerBuild } from './index-react-server-client-
|
|
4
|
-
export { h as Await, b as AwaitProps, V as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, as as DiscoverBehavior, y as FetcherFormProps, K as FetcherSubmitFunction, a9 as FetcherSubmitOptions, Q as FetcherWithComponents, _ as Form, z as FormProps, at as HandleDataRequestFunction, au as HandleDocumentRequestFunction, av as HandleErrorFunction, W as HashRouter, t as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, X as Link, v as LinkProps, am as Links, ap as LinksProps, i as MemoryRouter, M as MemoryRouterOpts, c as MemoryRouterProps, al as Meta, Z as NavLink, w as NavLinkProps, x as NavLinkRenderProps, j as Navigate, N as NavigateProps, k as Outlet, O as OutletProps, aa as ParamKeyValuePair, P as PathRouteProps, ar as PrefetchBehavior, ao as PrefetchPageLinks, l as Route, d as RouteProps, m as Router, e as RouterProps, n as RouterProvider, f as RouterProviderProps, o as Routes, g as RoutesProps, an as Scripts, aq as ScriptsProps, $ as ScrollRestoration, C as ScrollRestorationProps, aw as ServerEntryModule, G as SetURLSearchParams, aj as StaticRouter, af as StaticRouterProps, ak as StaticRouterProvider, ag as StaticRouterProviderProps, J as SubmitFunction, ab as SubmitOptions, ad as SubmitTarget, aF as UNSAFE_FrameworkContext, az as UNSAFE_WithComponentProps, aD as UNSAFE_WithErrorBoundaryProps, aB as UNSAFE_WithHydrateFallbackProps, aG as UNSAFE_createClientRoutes, aH as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ax as UNSAFE_hydrationRouteProperties, ay as UNSAFE_mapRouteProperties, aI as UNSAFE_shouldHydrateRouteLoader, aJ as UNSAFE_useScrollRestoration, aA as UNSAFE_withComponentProps, aE as UNSAFE_withErrorBoundaryProps, aC as UNSAFE_withHydrateFallbackProps, ac as URLSearchParamsInit, T as createBrowserRouter, U as createHashRouter, p as createMemoryRouter, q as createRoutesFromChildren, r as createRoutesFromElements, ae as createSearchParams, ah as createStaticHandler, ai as createStaticRouter, s as renderMatches, Y as unstable_HistoryRouter, a7 as unstable_usePrompt, a6 as useBeforeUnload, a4 as useFetcher, a5 as useFetchers, a3 as useFormAction, a0 as useLinkClickHandler, a1 as useSearchParams, a2 as useSubmit, a8 as useViewTransitionState } from './index-react-server-client-
|
|
1
|
+
import { d as Router, e as RouteModules, D as DataStrategyFunction, T as To, f as NavigateOptions, B as BlockerFunction, g as Blocker, h as SerializeFrom, i as RelativeRoutingType, a as Location, j as ParamParseKey, k as Path, l as PathPattern, m as PathMatch, U as UIMatch, n as Navigation, A as Action, o as Params, p as RouteObject, I as InitialEntry, H as HydrationState, q as IndexRouteObject, r as LoaderFunction, s as ActionFunction, t as MetaFunction, v as LinksFunction, w as NonIndexRouteObject, x as AppLoadContext, y as unstable_RouterContextProvider, z as MiddlewareEnabled, E as Equal, J as ClientActionFunction, K as ClientLoaderFunction, O as HeadersFunction, Q as ShouldRevalidateFunction, V as RouterInit, W as RouterState, X as PatchRoutesOnNavigationFunction, Y as DataRouteObject } from './routeModules-C3oqzPpI.js';
|
|
2
|
+
export { a7 as ActionFunctionArgs, aG as ClientActionFunctionArgs, aH as ClientLoaderFunctionArgs, aC as DataRouteMatch, a8 as DataStrategyFunctionArgs, a9 as DataStrategyMatch, aa as DataStrategyResult, ac as ErrorResponse, a1 as Fetcher, ad as FormEncType, ae as FormMethod, aM as Future, _ as GetScrollPositionFunction, $ as GetScrollRestorationKeyFunction, af as HTMLFormMethod, aI as HeadersArgs, aL as HtmlLinkDescriptor, as as IDLE_BLOCKER, ar as IDLE_FETCHER, aq as IDLE_NAVIGATION, ag as LazyRouteFunction, L as LinkDescriptor, ah as LoaderFunctionArgs, aJ as MetaArgs, M as MetaDescriptor, a2 as NavigationStates, aD as Navigator, aK as PageLinkDescriptor, aE as PatchRoutesOnNavigationFunctionArgs, aj as PathParam, ak as RedirectFunction, a6 as RevalidationState, aF as RouteMatch, a5 as RouterFetchOptions, a4 as RouterNavigateOptions, a3 as RouterSubscriber, am as ShouldRevalidateFunctionArgs, Z as StaticHandler, a0 as StaticHandlerContext, aS as UNSAFE_DataRouterContext, aT as UNSAFE_DataRouterStateContext, ab as UNSAFE_DataWithResponseInit, aR as UNSAFE_ErrorResponseImpl, aU as UNSAFE_FetchersContext, aV as UNSAFE_LocationContext, aW as UNSAFE_NavigationContext, aX as UNSAFE_RouteContext, aY as UNSAFE_ViewTransitionContext, aO as UNSAFE_createBrowserHistory, aQ as UNSAFE_createRouter, aP as UNSAFE_invariant, ao as createPath, at as data, au as generatePath, av as isRouteErrorResponse, aw as matchPath, ax as matchRoutes, ap as parsePath, ay as redirect, az as redirectDocument, aA as replace, aB as resolvePath, ai as unstable_MiddlewareFunction, al as unstable_RouterContext, aN as unstable_SerializesTo, an as unstable_createContext } from './routeModules-C3oqzPpI.js';
|
|
3
|
+
import { A as AssetsManifest, E as EntryContext, F as FutureConfig, R as RouteComponentType, H as HydrateFallbackType, a as ErrorBoundaryType, S as ServerBuild } from './index-react-server-client-BQ6FxdA_.js';
|
|
4
|
+
export { h as Await, b as AwaitProps, V as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, as as DiscoverBehavior, y as FetcherFormProps, K as FetcherSubmitFunction, a9 as FetcherSubmitOptions, Q as FetcherWithComponents, _ as Form, z as FormProps, at as HandleDataRequestFunction, au as HandleDocumentRequestFunction, av as HandleErrorFunction, W as HashRouter, t as HashRouterProps, u as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, X as Link, v as LinkProps, am as Links, ap as LinksProps, i as MemoryRouter, M as MemoryRouterOpts, c as MemoryRouterProps, al as Meta, Z as NavLink, w as NavLinkProps, x as NavLinkRenderProps, j as Navigate, N as NavigateProps, k as Outlet, O as OutletProps, aa as ParamKeyValuePair, P as PathRouteProps, ar as PrefetchBehavior, ao as PrefetchPageLinks, l as Route, d as RouteProps, m as Router, e as RouterProps, n as RouterProvider, f as RouterProviderProps, o as Routes, g as RoutesProps, an as Scripts, aq as ScriptsProps, $ as ScrollRestoration, C as ScrollRestorationProps, aw as ServerEntryModule, G as SetURLSearchParams, aj as StaticRouter, af as StaticRouterProps, ak as StaticRouterProvider, ag as StaticRouterProviderProps, J as SubmitFunction, ab as SubmitOptions, ad as SubmitTarget, aF as UNSAFE_FrameworkContext, az as UNSAFE_WithComponentProps, aD as UNSAFE_WithErrorBoundaryProps, aB as UNSAFE_WithHydrateFallbackProps, aG as UNSAFE_createClientRoutes, aH as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ax as UNSAFE_hydrationRouteProperties, ay as UNSAFE_mapRouteProperties, aI as UNSAFE_shouldHydrateRouteLoader, aJ as UNSAFE_useScrollRestoration, aA as UNSAFE_withComponentProps, aE as UNSAFE_withErrorBoundaryProps, aC as UNSAFE_withHydrateFallbackProps, ac as URLSearchParamsInit, T as createBrowserRouter, U as createHashRouter, p as createMemoryRouter, q as createRoutesFromChildren, r as createRoutesFromElements, ae as createSearchParams, ah as createStaticHandler, ai as createStaticRouter, s as renderMatches, Y as unstable_HistoryRouter, a7 as unstable_usePrompt, a6 as useBeforeUnload, a4 as useFetcher, a5 as useFetchers, a3 as useFormAction, a0 as useLinkClickHandler, a1 as useSearchParams, a2 as useSubmit, a8 as useViewTransitionState } from './index-react-server-client-BQ6FxdA_.js';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
@@ -215,6 +215,44 @@ interface NavigateFunction {
|
|
|
215
215
|
* middle of a page, and you don't want it to scroll to the top when a tab is
|
|
216
216
|
* clicked.
|
|
217
217
|
*
|
|
218
|
+
* ### Return Type Augmentation
|
|
219
|
+
*
|
|
220
|
+
* Internally, `useNavigate` uses a separate implementation when you are in
|
|
221
|
+
* Declarative mode versus Data/Framework mode - the primary difference being
|
|
222
|
+
* that the latter is able to return a stable reference that does not change
|
|
223
|
+
* identity across navigations. The implementation in Data/Framework mode also
|
|
224
|
+
* returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
|
225
|
+
* that resolves when the navigation is completed. This means the return type of
|
|
226
|
+
* `useNavigate` is `void | Promise<void>`. This is accurate, but can lead to
|
|
227
|
+
* some red squigglies based on the union in the return value:
|
|
228
|
+
*
|
|
229
|
+
* - If you're using `typescript-eslint`, you may see errors from
|
|
230
|
+
* [`@typescript-eslint/no-floating-promises`](https://typescript-eslint.io/rules/no-floating-promises)
|
|
231
|
+
* - In Framework/Data mode, `React.use(navigate())` will show a false-positive
|
|
232
|
+
* `Argument of type 'void | Promise<void>' is not assignable to parameter of
|
|
233
|
+
* type 'Usable<void>'` error
|
|
234
|
+
*
|
|
235
|
+
* The easiest way to work around these issues is to augment the type based on the
|
|
236
|
+
* router you're using:
|
|
237
|
+
*
|
|
238
|
+
* ```ts
|
|
239
|
+
* // If using <BrowserRouter>
|
|
240
|
+
* declare module "react-router" {
|
|
241
|
+
* interface NavigateFunction {
|
|
242
|
+
* (to: To, options?: NavigateOptions): void;
|
|
243
|
+
* (delta: number): void;
|
|
244
|
+
* }
|
|
245
|
+
* }
|
|
246
|
+
*
|
|
247
|
+
* // If using <RouterProvider> or Framework mode
|
|
248
|
+
* declare module "react-router" {
|
|
249
|
+
* interface NavigateFunction {
|
|
250
|
+
* (to: To, options?: NavigateOptions): Promise<void>;
|
|
251
|
+
* (delta: number): Promise<void>;
|
|
252
|
+
* }
|
|
253
|
+
* }
|
|
254
|
+
* ```
|
|
255
|
+
*
|
|
218
256
|
* @public
|
|
219
257
|
* @category Hooks
|
|
220
258
|
* @returns A navigate function for programmatic navigation
|