File tree Expand file tree Collapse file tree 6 files changed +31
-16
lines changed Expand file tree Collapse file tree 6 files changed +31
-16
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ export type {
7878 NavigateOptions ,
7979 Navigator ,
8080 NonIndexRouteObject ,
81+ PatchRoutesOnNavigationFunction ,
82+ PatchRoutesOnNavigationFunctionArgs ,
8183 RouteMatch ,
8284 RouteObject ,
8385} from "./lib/context" ;
@@ -93,7 +95,6 @@ export type {
9395 RouterProps ,
9496 RouterProviderProps ,
9597 RoutesProps ,
96- PatchRoutesOnNavigationFunction as PatchRoutesOnNavigationFunction ,
9798} from "./lib/components" ;
9899export type { NavigateFunction } from "./lib/hooks" ;
99100export {
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ import type {
2323} from "./router/router" ;
2424import { createRouter } from "./router/router" ;
2525import type {
26- AgnosticPatchRoutesOnNavigationFunction ,
2726 DataStrategyFunction ,
2827 LazyRouteFunction ,
2928 TrackedPromise ,
@@ -35,6 +34,7 @@ import type {
3534 IndexRouteObject ,
3635 Navigator ,
3736 NonIndexRouteObject ,
37+ PatchRoutesOnNavigationFunction ,
3838 RouteMatch ,
3939 RouteObject ,
4040 ViewTransitionContextObject ,
@@ -130,9 +130,6 @@ export function mapRouteProperties(route: RouteObject) {
130130 return updates ;
131131}
132132
133- export interface PatchRoutesOnNavigationFunction
134- extends AgnosticPatchRoutesOnNavigationFunction < RouteMatch > { }
135-
136133/**
137134 * @category Routers
138135 */
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ import type {
1313import type {
1414 AgnosticIndexRouteObject ,
1515 AgnosticNonIndexRouteObject ,
16+ AgnosticPatchRoutesOnNavigationFunction ,
17+ AgnosticPatchRoutesOnNavigationFunctionArgs ,
1618 AgnosticRouteMatch ,
1719 LazyRouteFunction ,
1820 TrackedPromise ,
@@ -74,6 +76,12 @@ export interface RouteMatch<
7476
7577export interface DataRouteMatch extends RouteMatch < string , DataRouteObject > { }
7678
79+ export type PatchRoutesOnNavigationFunctionArgs =
80+ AgnosticPatchRoutesOnNavigationFunctionArgs < RouteObject , RouteMatch > ;
81+
82+ export type PatchRoutesOnNavigationFunction =
83+ AgnosticPatchRoutesOnNavigationFunction < RouteObject , RouteMatch > ;
84+
7785export interface DataRouterContextObject
7886 // Omit `future` since those can be pulled from the `router`
7987 // `NavigationContext` needs future since it doesn't have a `router` in all cases
Original file line number Diff line number Diff line change @@ -64,9 +64,12 @@ import {
6464 mergeRefs ,
6565 usePrefetchBehavior ,
6666} from "./ssr/components" ;
67- import type { PatchRoutesOnNavigationFunction } from "../components" ;
6867import { Router , mapRouteProperties } from "../components" ;
69- import type { RouteObject , NavigateOptions } from "../context" ;
68+ import type {
69+ RouteObject ,
70+ NavigateOptions ,
71+ PatchRoutesOnNavigationFunction ,
72+ } from "../context" ;
7073import {
7174 DataRouterContext ,
7275 DataRouterStateContext ,
Original file line number Diff line number Diff line change 11import * as React from "react" ;
2- import type { PatchRoutesOnNavigationFunction } from "../../components " ;
2+ import type { PatchRoutesOnNavigationFunction } from "../../context " ;
33import type { Router as RemixRouter } from "../../router/router" ;
44import { matchRoutes } from "../../router/utils" ;
55import type { AssetsManifest } from "./entry" ;
Original file line number Diff line number Diff line change @@ -223,15 +223,21 @@ export interface DataStrategyFunction {
223223 ( args : DataStrategyFunctionArgs ) : Promise < Record < string , DataStrategyResult > > ;
224224}
225225
226- export interface AgnosticPatchRoutesOnNavigationFunction <
226+ export type AgnosticPatchRoutesOnNavigationFunctionArgs <
227+ O extends AgnosticRouteObject = AgnosticRouteObject ,
227228 M extends AgnosticRouteMatch = AgnosticRouteMatch
228- > {
229- ( opts : {
230- path : string ;
231- matches : M [ ] ;
232- patch : ( routeId : string | null , children : AgnosticRouteObject [ ] ) => void ;
233- } ) : void | Promise < void > ;
234- }
229+ > = {
230+ path : string ;
231+ matches : M [ ] ;
232+ patch : ( routeId : string | null , children : O [ ] ) => void ;
233+ } ;
234+
235+ export type AgnosticPatchRoutesOnNavigationFunction <
236+ O extends AgnosticRouteObject = AgnosticRouteObject ,
237+ M extends AgnosticRouteMatch = AgnosticRouteMatch
238+ > = (
239+ opts : AgnosticPatchRoutesOnNavigationFunctionArgs < O , M >
240+ ) => void | Promise < void > ;
235241
236242/**
237243 * Function provided by the framework-aware layers to set any framework-specific
You can’t perform that action at this time.
0 commit comments