diff --git a/packages/core-api/src/app/App.tsx b/packages/core-api/src/app/App.tsx index e9855e0a95..0aed43846d 100644 --- a/packages/core-api/src/app/App.tsx +++ b/packages/core-api/src/app/App.tsx @@ -15,7 +15,7 @@ */ import React, { ComponentType, FC } from 'react'; -import { Route, Redirect, Routes, Navigate } from 'react-router-dom'; +import { Route, Routes, Navigate } from 'react-router-dom'; import { AppContextProvider } from './AppContext'; import { BackstageApp, AppComponents, AppConfigLoader } from './types'; import { BackstagePlugin } from '../plugin'; diff --git a/packages/core/src/layout/ErrorPage/ErrorPage.tsx b/packages/core/src/layout/ErrorPage/ErrorPage.tsx index fa2315307f..d6620295c1 100644 --- a/packages/core/src/layout/ErrorPage/ErrorPage.tsx +++ b/packages/core/src/layout/ErrorPage/ErrorPage.tsx @@ -40,7 +40,7 @@ const useStyles = makeStyles(theme => ({ export const ErrorPage = ({ status, statusMessage }: IErrorPageProps) => { const classes = useStyles(); - const history = useNavigate(); + const navigate = useNavigate(); return ( @@ -53,7 +53,7 @@ export const ErrorPage = ({ status, statusMessage }: IErrorPageProps) => { Looks like someone dropped the mic! - + navigate(-1)}> Go back ... or if you think this is a bug, please file an{' '} diff --git a/packages/core/src/layout/Sidebar/Items.tsx b/packages/core/src/layout/Sidebar/Items.tsx index ddd71cc189..1b5a1e9d91 100644 --- a/packages/core/src/layout/Sidebar/Items.tsx +++ b/packages/core/src/layout/Sidebar/Items.tsx @@ -139,8 +139,7 @@ export const SidebarItem: FC = ({ Boolean(match && !disableSelected)} - exact + end to={to} onClick={onClick} > @@ -153,8 +152,7 @@ export const SidebarItem: FC = ({ Boolean(match && !disableSelected)} - exact + end to={to} onClick={onClick} > diff --git a/plugins/lighthouse/src/components/AuditList/index.tsx b/plugins/lighthouse/src/components/AuditList/index.tsx index 28fbc06ce1..09ea882134 100644 --- a/plugins/lighthouse/src/components/AuditList/index.tsx +++ b/plugins/lighthouse/src/components/AuditList/index.tsx @@ -65,7 +65,7 @@ const AuditList: FC<{}> = () => { return 0; }, [value?.total, value?.limit]); - const history = useNavigate(); + const navigate = useNavigate(); let content: ReactNode = null; if (value) { @@ -77,7 +77,7 @@ const AuditList: FC<{}> = () => { page={page} count={pageCount} onChange={(_event: Event, newPage: number) => { - history.replace(`/lighthouse?page=${newPage}`); + navigate(`/lighthouse?page=${newPage}`); }} /> )} diff --git a/plugins/lighthouse/src/components/CreateAudit/index.tsx b/plugins/lighthouse/src/components/CreateAudit/index.tsx index 4c7570221c..a699e148c8 100644 --- a/plugins/lighthouse/src/components/CreateAudit/index.tsx +++ b/plugins/lighthouse/src/components/CreateAudit/index.tsx @@ -58,7 +58,7 @@ const CreateAudit: FC<{}> = () => { const lighthouseApi = useApi(lighthouseApiRef); const classes = useStyles(); const query = useQuery(); - const history = useNavigate(); + const navigate = useNavigate(); const [submitting, setSubmitting] = useState(false); const [url, setUrl] = useState(query.get('url') || ''); const [emulatedFormFactor, setEmulatedFormFactor] = useState('mobile'); @@ -78,7 +78,7 @@ const CreateAudit: FC<{}> = () => { }, }, }); - history.push('/lighthouse'); + navigate('/lighthouse'); } catch (err) { errorApi.post(err); } finally { @@ -90,7 +90,7 @@ const CreateAudit: FC<{}> = () => { lighthouseApi, setSubmitting, errorApi, - history, + navigate, ]); return (