From 299589040faf7ff112cd8c74625a0103f03f54fa Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 14 May 2020 15:14:24 +0200 Subject: [PATCH] packages/core: use useHistory in ErrorPage instead of passing via props --- packages/core/src/layout/ErrorPage/ErrorPage.test.tsx | 6 +----- packages/core/src/layout/ErrorPage/ErrorPage.tsx | 7 +++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/core/src/layout/ErrorPage/ErrorPage.test.tsx b/packages/core/src/layout/ErrorPage/ErrorPage.test.tsx index 1309fdf474..06c12041b9 100644 --- a/packages/core/src/layout/ErrorPage/ErrorPage.test.tsx +++ b/packages/core/src/layout/ErrorPage/ErrorPage.test.tsx @@ -23,11 +23,7 @@ describe('', () => { it('should render with status code, status message and go back link', () => { const rendered = render( wrapInThemedTestApp( - {} }} - />, + , ), ); rendered.getByText(/page not found/i); diff --git a/packages/core/src/layout/ErrorPage/ErrorPage.tsx b/packages/core/src/layout/ErrorPage/ErrorPage.tsx index 49b79ef925..14241c1ee7 100644 --- a/packages/core/src/layout/ErrorPage/ErrorPage.tsx +++ b/packages/core/src/layout/ErrorPage/ErrorPage.tsx @@ -19,13 +19,11 @@ import { Typography, Link, Grid } from '@material-ui/core'; import { makeStyles } from '@material-ui/core/styles'; import { BackstageTheme } from '@backstage/theme'; import MicDrop from './MicDrop'; +import { useHistory } from 'react-router'; interface IErrorPageProps { status: string; statusMessage: string; - history: { - goBack: () => void; - }; } const useStyles = makeStyles((theme) => ({ @@ -40,8 +38,9 @@ const useStyles = makeStyles((theme) => ({ }, })); -const ErrorPage = ({ status, statusMessage, history }: IErrorPageProps) => { +const ErrorPage = ({ status, statusMessage }: IErrorPageProps) => { const classes = useStyles(); + const history = useHistory(); return (