core-compat-api: wrap discovered elements with compatWrapper

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-01-07 14:37:56 +01:00
parent ae28f1266c
commit 4c1f50cbd2
2 changed files with 16 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-compat-api': patch
---
Make `convertLegacyApp` wrap discovered routes with `compatWrapper`.
@@ -33,6 +33,7 @@ import {
import React, { Children, ReactNode, isValidElement } from 'react';
import { Route, Routes } from 'react-router-dom';
import { convertLegacyRouteRef } from './convertLegacyRouteRef';
import { compatWrapper } from './compatWrapper';
/*
@@ -207,14 +208,16 @@ export function collectLegacyRoutes(
}),
},
loader: async () =>
route.props.children ? (
<Routes>
<Route path="*" element={routeElement}>
<Route path="*" element={route.props.children} />
</Route>
</Routes>
) : (
routeElement
compatWrapper(
route.props.children ? (
<Routes>
<Route path="*" element={routeElement}>
<Route path="*" element={route.props.children} />
</Route>
</Routes>
) : (
routeElement
),
),
}),
);