Merge pull request #3854 from backstage/rugvip/flat

core-api: rename BackstageRoutes to FlatRoutes
This commit is contained in:
Patrik Oldsberg
2020-12-28 13:36:39 +01:00
committed by GitHub
4 changed files with 7 additions and 9 deletions
+1 -1
View File
@@ -3,4 +3,4 @@
'@backstage/core': patch
---
Add `BackstageRoutes` component to replace the top-level `Routes` component from `react-router` within apps, removing the need for manually appending `/*` to paths or sorting routes.
Add `FlatRoutes` component to replace the top-level `Routes` component from `react-router` within apps, removing the need for manually appending `/*` to paths or sorting routes.
@@ -66,13 +66,11 @@ function createRoutesFromChildren(children: ReactNode): RouteObject[] {
});
}
type BackstageRoutesProps = {
type FlatRoutesProps = {
children: ReactNode;
};
export const BackstageRoutes = (
props: BackstageRoutesProps,
): JSX.Element | null => {
export const FlatRoutes = (props: FlatRoutesProps): JSX.Element | null => {
const routes = createRoutesFromChildren(props.children);
return useRoutes(routes);
};
+1 -1
View File
@@ -21,6 +21,6 @@ export type {
ConcreteRoute,
MutableRouteRef,
} from './types';
export { BackstageRoutes } from './BackstageRoutes';
export { FlatRoutes } from './FlatRoutes';
export { createRouteRef } from './RouteRef';
export { useRouteRef } from './hooks';
+3 -3
View File
@@ -30,7 +30,7 @@ import {
OAuthRequestDialog,
AnyApiFactory,
IconComponent,
BackstageRoutes,
FlatRoutes,
attachComponentData,
} from '@backstage/core';
import SentimentDissatisfiedIcon from '@material-ui/icons/SentimentDissatisfied';
@@ -133,10 +133,10 @@ class DevAppBuilder {
<AppRouter>
<SidebarPage>
{sidebar}
<BackstageRoutes>
<FlatRoutes>
{this.routes}
{deprecatedAppRoutes}
</BackstageRoutes>
</FlatRoutes>
</SidebarPage>
</AppRouter>
</AppProvider>