Skip to content
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 RemixBrowser routes prop #9062

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Mar 15, 2024

This eases the migration path of RouterProvider to Remix SPA Mode by allowing folks to lift their current routes and pass them to RemixBrowser instead of needing to go to file-based routes (via routes/ or defineRoutes)

Todo:

  • Docs

Copy link

changeset-bot bot commented Mar 15, 2024

🦋 Changeset detected

Latest commit: f738c2a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@remix-run/dev Minor
@remix-run/react Minor
@remix-run/server-runtime Minor
@remix-run/testing Minor
@remix-run/cloudflare Minor
@remix-run/deno Minor
@remix-run/node Minor
@remix-run/cloudflare-pages Minor
@remix-run/cloudflare-workers Minor
@remix-run/architect Minor
@remix-run/express Minor
@remix-run/serve Minor
create-remix Minor
remix Minor
@remix-run/css-bundle Minor
@remix-run/eslint-config Minor

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

if (!route.loader) {
route = { ...route, loader: hydratingLoader };
}
rootRoute.children.push(route);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the routes as children of the root route

} else {
let rootDataRoute = router.routes[0];
rootDataRoute.children?.forEach((route) =>
addPropRoutesToRemix(route as DataRouteObject, rootDataRoute.id)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the routes to window.__remixManifest and window__remixRouteModules

hasErrorBoundary: route.hasErrorBoundary === true,
imports: [],
css: [],
module: undefined,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't have modules to fetch, so that required some changes elsewhere to make manifestRoute.module an optional field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant