-
-
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
Conversation
🦋 Changeset detectedLatest commit: 1185365 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Naming of this file may be temporary - went with dom-export
to avoid ambiguity with the existing dom/
folder containing the old react-router-dom
implementation - but open to suggestions
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
We have to export a bunch of stuff as UNSAFE
here to consume from the subpath export file to avoid duplicating any implementations
*/ | ||
export function RouterProvider({ | ||
router, | ||
flushSync: reactDomFlushSyncImpl, |
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.
This is the same implementation as before, copied into here but with flushSync dependency injected via a prop
warnOnce( | ||
flushSync === false || reactDomFlushSyncImpl != null, | ||
"You provided the `unstable_flushSync` option to a router update, " + | ||
"but you are not using the `<RouterProvider>` from `react-router/dom` " + | ||
"so `ReactDOM.flushSync()` is unavailable. Please update your app " + | ||
'to `import { RouterProvider } from "react-router/dom"` and ensure ' + | ||
"you have `react-dom` installed as a dependency to use the " + | ||
"`unstable_flushSync` option." | ||
); | ||
|
||
let isViewTransitionAvailable = | ||
router.window != null && | ||
router.window.document != null && | ||
typeof router.window.document.startViewTransition === "function"; | ||
|
||
warnOnce( | ||
viewTransitionOpts == null || isViewTransitionAvailable, | ||
"You provided the `unstable_viewTransition` option to a router update, " + | ||
"but you do not appear to be running in a DOM environment as " + | ||
"`window.startViewTransition` is not available." | ||
); |
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.
Helpful warnings we didn't have before
await setup({ base: "/mybase/", basename: "/mybase/app/" }); | ||
await workflowDev({ page, cwd, port, basename: "/mybase/app/" }); | ||
await setup({ base: "/mybase/", basename: "/mybase/dashboard/" }); | ||
await workflowDev({ page, cwd, port, basename: "/mybase/dashboard/" }); |
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 the app
folder in requests in vite dev mode
🤖 Hello there, We just published version Thanks! |
No description provided.