Skip to content

Commit

Permalink
Opt in to some v7 features in react-router
Browse files Browse the repository at this point in the history
This eliminates some warnings and doesn't appear harmful.
  • Loading branch information
daniel-ac-martin committed Jan 5, 2025
1 parent 6bdaa9d commit b86a7b6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/client-renderer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ export const hydrateOrRender: HydrateOrRender = ({
user
});
const router = createBrowserRouter(routes, {
basename
basename,
future: {
v7_relativeSplatPath: true
}
});
const app = (
h(RouterWrap, appProps,
h(RouterProvider, {
future: {
v7_startTransition: true
},
router,
fallbackElement: h(LoadingPage, { ...appProps, routes: [] })
}))
Expand Down
4 changes: 4 additions & 0 deletions lib/component-test-helpers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const Providers: FC<{ children?: ReactNode, routerProps?: object }> = ({
}) => (
h(HelmetProvider, {},
h(MemoryRouter, routerProps || {
future: {
v7_relativeSplatPath: true,
v7_startTransition: true
},
initialEntries: ['/previous', '/current', '/next'],
initialIndex: 1
}, children) )
Expand Down
7 changes: 6 additions & 1 deletion lib/server-renderer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,12 @@ export const reactRenderer: ReactRenderer = ({
user: { ...user, accessToken: req.auth?.accessToken } // Add the access token separately, in order to keep it off the client
});
const basename = '/';
const { query, dataRoutes } = createStaticHandler(routes, { basename });
const { query, dataRoutes } = createStaticHandler(routes, {
basename,
future: {
v7_relativeSplatPath: true
}
});

const nonce = res.nonce || '';
const createApp = (router: Router, context: StaticHandlerContext) => (
Expand Down

1 comment on commit b86a7b6

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

Please sign in to comment.