Revert react-router v7 future flags from #31818

Roll back the v7_relativeSplatPath and v7_startTransition future flags
and the Outlet-based route structure, keeping the version bump to
react-router-dom@^6.30.2.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2026-02-12 09:59:49 +01:00
parent 36573c6dd0
commit 47d064a51b
6 changed files with 20 additions and 78 deletions
+1 -11
View File
@@ -198,17 +198,7 @@ export interface AppRouterProps {
function DefaultRouter(props: PropsWithChildren<{}>) {
const configApi = useApi(configApiRef);
const basePath = getBasePath(configApi);
return (
<BrowserRouter
basename={basePath}
future={{
v7_relativeSplatPath: true,
v7_startTransition: true,
}}
>
{props.children}
</BrowserRouter>
);
return <BrowserRouter basename={basePath}>{props.children}</BrowserRouter>;
}
/**
+7 -35
View File
@@ -20,7 +20,7 @@ import {
createExtensionInput,
NotFoundErrorPage,
} from '@backstage/frontend-plugin-api';
import { useRoutes, Outlet } from 'react-router-dom';
import { useRoutes } from 'react-router-dom';
export const AppRoutes = createExtension({
name: 'routes',
@@ -38,42 +38,14 @@ export const AppRoutes = createExtension({
const element = useRoutes([
...inputs.routes.map(route => {
const routePath = route.get(coreExtensionData.routePath);
const routeElement = route.get(coreExtensionData.reactElement);
// For v7_relativeSplatPath: convert splat paths to parent/child structure
if (routePath === '/') {
// Root route: parent with index and splat children
return {
path: '/',
element: <Outlet />,
children: [
{
index: true,
element: routeElement,
},
{
path: '*',
element: routeElement,
},
],
};
}
// Non-root routes: parent route with splat child
const normalizedPath = routePath.replace(/\/$/, '');
return {
path: normalizedPath,
element: <Outlet />,
children: [
{
index: true,
element: routeElement,
},
{
path: '*',
element: routeElement,
},
],
path:
routePath === '/'
? routePath
: `${routePath.replace(/\/$/, '')}/*`,
element: route.get(coreExtensionData.reactElement),
};
}),
{