app,create-app: migrate to wrapping <Navigate /> in a <Route />

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-03-26 17:53:44 +01:00
parent c1f1a4c760
commit 2b4ed3f8de
3 changed files with 15 additions and 2 deletions
+13
View File
@@ -0,0 +1,13 @@
---
'@backstage/create-app': patch
---
Update the setup of the app routes in the template to wrap the `<Navigate .../>` redirect in a `<Route .../>`, as this will be required in `react-router` v6 stable.
To apply this change to an existing app, make the following change to `packages/app/src/App.tsx`:
```diff
<FlatRoutes>
- <Navigate key="/" to="catalog" />
+ <Route path="/" element={<Navigate to="catalog" />} />
```
+1 -1
View File
@@ -145,7 +145,7 @@ const AppRouter = app.getRouter();
const routes = (
<FlatRoutes>
<Navigate key="/" to="catalog" />
<Route path="/" element={<Navigate to="catalog" />} />
{/* TODO(rubenl): Move this to / once its more mature and components exist */}
<Route path="/home" element={<HomepageCompositionRoot />}>
{homePage}
@@ -58,7 +58,7 @@ const AppRouter = app.getRouter();
const routes = (
<FlatRoutes>
<Navigate key="/" to="catalog" />
<Route path="/" element={<Navigate to="catalog" />} />
<Route path="/catalog" element={<CatalogIndexPage />} />
<Route
path="/catalog/:namespace/:kind/:name"