From 5b6533eb76aea627c295b23d40b68664e6a31c15 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 24 Dec 2020 12:53:02 +0100 Subject: [PATCH] core-api: rename BackstageRoutes to FlatRoutes --- .changeset/dull-seals-march.md | 2 +- .../src/routing/{BackstageRoutes.tsx => FlatRoutes.tsx} | 6 ++---- packages/core-api/src/routing/index.ts | 2 +- packages/dev-utils/src/devApp/render.tsx | 6 +++--- 4 files changed, 7 insertions(+), 9 deletions(-) rename packages/core-api/src/routing/{BackstageRoutes.tsx => FlatRoutes.tsx} (94%) diff --git a/.changeset/dull-seals-march.md b/.changeset/dull-seals-march.md index 714c5c5cad..49e1f7f2e6 100644 --- a/.changeset/dull-seals-march.md +++ b/.changeset/dull-seals-march.md @@ -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. diff --git a/packages/core-api/src/routing/BackstageRoutes.tsx b/packages/core-api/src/routing/FlatRoutes.tsx similarity index 94% rename from packages/core-api/src/routing/BackstageRoutes.tsx rename to packages/core-api/src/routing/FlatRoutes.tsx index 6c042af27d..a6783964a7 100644 --- a/packages/core-api/src/routing/BackstageRoutes.tsx +++ b/packages/core-api/src/routing/FlatRoutes.tsx @@ -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); }; diff --git a/packages/core-api/src/routing/index.ts b/packages/core-api/src/routing/index.ts index 2bdf0aa5e8..9564b3b225 100644 --- a/packages/core-api/src/routing/index.ts +++ b/packages/core-api/src/routing/index.ts @@ -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'; diff --git a/packages/dev-utils/src/devApp/render.tsx b/packages/dev-utils/src/devApp/render.tsx index f15a4c4078..f1a6d30b4c 100644 --- a/packages/dev-utils/src/devApp/render.tsx +++ b/packages/dev-utils/src/devApp/render.tsx @@ -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 { {sidebar} - + {this.routes} {deprecatedAppRoutes} - +