Skip to content

Commit

Permalink
chore: Opt-in React Router v7 features (#2929) (CP: 24.5) (#2967)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshabarov authored Dec 11, 2024
1 parent 4cc8097 commit 4ec4f1e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,22 @@ export class RouterConfigurationBuilder {

return {
routes,
router: createBrowserRouter([...routes], { basename: new URL(document.baseURI).pathname, ...options }),
router: createBrowserRouter([...routes], {
basename: new URL(document.baseURI).pathname,
future: {
// eslint-disable-next-line camelcase
v7_fetcherPersist: true,
// eslint-disable-next-line camelcase
v7_normalizeFormMethod: true,
// eslint-disable-next-line camelcase
v7_partialHydration: true,
// eslint-disable-next-line camelcase
v7_relativeSplatPath: true,
// eslint-disable-next-line camelcase
v7_skipActionErrorRevalidation: true,
},
...options,
}),
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,21 @@ describe('RouterBuilder', () => {
const { routes, router } = builder.build();

expect(router).to.equal(browserRouter);
expect(createBrowserRouter).to.have.been.calledWith(routes, { basename: '/foo' });
expect(createBrowserRouter).to.have.been.calledWith(routes, {
basename: '/foo',
future: {
// eslint-disable-next-line camelcase
v7_fetcherPersist: true,
// eslint-disable-next-line camelcase
v7_normalizeFormMethod: true,
// eslint-disable-next-line camelcase
v7_partialHydration: true,
// eslint-disable-next-line camelcase
v7_relativeSplatPath: true,
// eslint-disable-next-line camelcase
v7_skipActionErrorRevalidation: true,
},
});
reset();
});
});

0 comments on commit 4ec4f1e

Please sign in to comment.