app: fix routing when PageExtensions are mounted on /

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2025-10-03 15:36:57 +02:00
parent 302f210aa9
commit d95d88cd23
+12 -6
View File
@@ -36,12 +36,18 @@ export const AppRoutes = createExtension({
factory({ inputs }) {
const Routes = () => {
const element = useRoutes([
...inputs.routes.map(route => ({
path: `${route
.get(coreExtensionData.routePath)
.replace(/\/$/, '')}/*`,
element: route.get(coreExtensionData.reactElement),
})),
...inputs.routes.map(route => {
const routePath = route.get(coreExtensionData.routePath);
return {
path:
routePath === '/'
? routePath
: `${routePath.replace(/\/$/, '')}/*`,
element: route.get(coreExtensionData.reactElement),
};
}),
{
path: '*',
element: <NotFoundErrorPage />,