-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dom subpath export #11851
Add dom subpath export #11851
Changes from all commits
32eae06
9c18126
0f73a6a
5bcc9f7
4da96c9
724d05b
1185365
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
"react-router": major | ||
--- | ||
|
||
Add `react-router/dom` subpath export to properly enable `react-dom` as an optional `peerDependency` | ||
|
||
- This ensures that we don't blindly `import ReactDOM from "react-dom"` in `<RouterProvider>` in order to access `ReactDOM.flushSync()`, since that would break `createMemoryRouter` use cases in non-DOM environments | ||
- DOM environments should import from `react-router/dom` to get the proper component that makes `ReactDOM.flushSync()` available: | ||
- If you are using the Vite plugin, use this in your `entry.client.tsx`: | ||
- `import { HydratedRouter } from 'react-router/dom'` | ||
- If you are not using the Vite plugin and are manually calling `createBrowserRouter`/`createHashRouter`: | ||
- `import { RouterProvider } from "react-router/dom"` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export type { RouterProviderProps } from "./lib/dom-export/dom-router-provider"; | ||
export { RouterProvider } from "./lib/dom-export/dom-router-provider"; | ||
export { HydratedRouter } from "./lib/dom-export/hydrated-router"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Naming of this file may be temporary - went with |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,7 @@ export type { | |
PathRouteProps, | ||
RouteProps, | ||
RouterProps, | ||
RouterProviderProps, | ||
RoutesProps, | ||
PatchRoutesOnMissFunction as unstable_PatchRoutesOnMissFunction, | ||
} from "./lib/components"; | ||
|
@@ -99,6 +100,7 @@ export { | |
Outlet, | ||
Route, | ||
Router, | ||
RouterProvider, | ||
Routes, | ||
createMemoryRouter, | ||
createRoutesFromChildren, | ||
|
@@ -144,7 +146,6 @@ export type { | |
SubmitFunction, | ||
FetcherSubmitFunction, | ||
FetcherWithComponents, | ||
RouterProviderProps, | ||
} from "./lib/dom/lib"; | ||
export { | ||
createBrowserRouter, | ||
|
@@ -155,7 +156,6 @@ export { | |
HistoryRouter as unstable_HistoryRouter, | ||
NavLink, | ||
Form, | ||
RouterProvider, | ||
ScrollRestoration, | ||
useLinkClickHandler, | ||
useSearchParams, | ||
|
@@ -185,7 +185,6 @@ export { | |
StaticRouter, | ||
StaticRouterProvider, | ||
} from "./lib/dom/server"; | ||
export { HydratedRouter } from "./lib/dom/ssr/browser"; | ||
export { | ||
Meta, | ||
Links, | ||
|
@@ -338,32 +337,70 @@ export type { | |
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
/** @internal */ | ||
export { ErrorResponseImpl as UNSAFE_ErrorResponseImpl } from "./lib/router/utils"; | ||
export { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have to export a bunch of stuff as |
||
createBrowserHistory as UNSAFE_createBrowserHistory, | ||
invariant as UNSAFE_invariant, | ||
} from "./lib/router/history"; | ||
|
||
/** @internal */ | ||
export { | ||
decodeViaTurboStream as UNSAFE_decodeViaTurboStream, | ||
SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, | ||
} from "./lib/dom/ssr/single-fetch"; | ||
export { createRouter as UNSAFE_createRouter } from "./lib/router/router"; | ||
|
||
/** @internal */ | ||
export { ErrorResponseImpl as UNSAFE_ErrorResponseImpl } from "./lib/router/utils"; | ||
|
||
/** @internal */ | ||
export { | ||
DataRouterContext as UNSAFE_DataRouterContext, | ||
DataRouterStateContext as UNSAFE_DataRouterStateContext, | ||
FetchersContext as UNSAFE_FetchersContext, | ||
LocationContext as UNSAFE_LocationContext, | ||
NavigationContext as UNSAFE_NavigationContext, | ||
RouteContext as UNSAFE_RouteContext, | ||
ViewTransitionContext as UNSAFE_ViewTransitionContext, | ||
} from "./lib/context"; | ||
|
||
/** @internal */ | ||
export { | ||
ViewTransitionContext as UNSAFE_ViewTransitionContext, | ||
FetchersContext as UNSAFE_FetchersContext, | ||
useScrollRestoration as UNSAFE_useScrollRestoration, | ||
} from "./lib/dom/lib"; | ||
export { mapRouteProperties as UNSAFE_mapRouteProperties } from "./lib/components"; | ||
|
||
/** @internal */ | ||
export { FrameworkContext as UNSAFE_FrameworkContext } from "./lib/dom/ssr/components"; | ||
|
||
/** @internal */ | ||
export type { AssetsManifest as UNSAFE_AssetsManifest } from "./lib/dom/ssr/entry"; | ||
|
||
/** @internal */ | ||
export { deserializeErrors as UNSAFE_deserializeErrors } from "./lib/dom/ssr/errors"; | ||
|
||
/** @internal */ | ||
export { RemixErrorBoundary as UNSAFE_RemixErrorBoundary } from "./lib/dom/ssr/errorBoundaries"; | ||
|
||
/** @internal */ | ||
export { | ||
initFogOfWar as UNSAFE_initFogOfWar, | ||
useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, | ||
} from "./lib/dom/ssr/fog-of-war"; | ||
|
||
/** @internal */ | ||
export type { RouteModules as UNSAFE_RouteModules } from "./lib/dom/ssr/routeModules"; | ||
|
||
/** @internal */ | ||
export { | ||
createClientRoutes as UNSAFE_createClientRoutes, | ||
createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, | ||
shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, | ||
} from "./lib/dom/ssr/routes"; | ||
|
||
/** @internal */ | ||
export { getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy } from "./lib/dom/ssr/single-fetch"; | ||
|
||
/** @internal */ | ||
export { | ||
decodeViaTurboStream as UNSAFE_decodeViaTurboStream, | ||
SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, | ||
} from "./lib/dom/ssr/single-fetch"; | ||
|
||
/** @internal */ | ||
export { ServerMode as UNSAFE_ServerMode } from "./lib/server-runtime/mode"; | ||
|
||
/** @internal */ | ||
export { useScrollRestoration as UNSAFE_useScrollRestoration } from "./lib/dom/lib"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this to avoid ambiguity between the
app
URL path and theapp
folder in requests in vite dev mode