diff options
author | Jeremy Davis <jeremy.davis@sonarsource.com> | 2022-06-13 11:39:21 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-06-28 20:02:53 +0000 |
commit | 54732569670fc345367062d5b20fcca83d9f7692 (patch) | |
tree | 8a3d86a9b76fbc056b74ac68ff8b38db9cee2cb1 /server/sonar-web/src/main/js/app/components/GlobalContainer.tsx | |
parent | 26675093303e38f1973f3ee9da5750aeeb2a5a5f (diff) | |
download | sonarqube-54732569670fc345367062d5b20fcca83d9f7692.tar.gz sonarqube-54732569670fc345367062d5b20fcca83d9f7692.zip |
SONAR-16045 Migrate react-router to 6.3.0
Co-authored-by: Jeremy Davis <jeremy.davis@sonarsource.com>
Co-authored-by: Guillaume Péoc'h <guillaume.peoch@sonarsource.com>
Diffstat (limited to 'server/sonar-web/src/main/js/app/components/GlobalContainer.tsx')
-rw-r--r-- | server/sonar-web/src/main/js/app/components/GlobalContainer.tsx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx b/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx index 6bc280ca84f..f9f4cecc211 100644 --- a/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx +++ b/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { Outlet, useLocation } from 'react-router-dom'; import A11yProvider from '../../components/a11y/A11yProvider'; import A11ySkipLinks from '../../components/a11y/A11ySkipLinks'; import SuggestionsProvider from '../../components/embed-docs-modal/SuggestionsProvider'; @@ -33,15 +34,10 @@ import PromotionNotification from './promotion-notification/PromotionNotificatio import StartupModal from './StartupModal'; import UpdateNotification from './update-notification/UpdateNotification'; -export interface Props { - children: React.ReactNode; - footer?: React.ReactNode; - location: { pathname: string }; -} - -export default function GlobalContainer(props: Props) { +export default function GlobalContainer() { // it is important to pass `location` down to `GlobalNav` to trigger render on url change - const { footer = <GlobalFooter /> } = props; + const location = useLocation(); + return ( <SuggestionsProvider> <A11yProvider> @@ -55,10 +51,10 @@ export default function GlobalContainer(props: Props) { <IndexationContextProvider> <LanguagesContextProvider> <MetricsContextProvider> - <GlobalNav location={props.location} /> + <GlobalNav location={location} /> <IndexationNotification /> <UpdateNotification dismissable={true} /> - {props.children} + <Outlet /> </MetricsContextProvider> </LanguagesContextProvider> </IndexationContextProvider> @@ -67,7 +63,7 @@ export default function GlobalContainer(props: Props) { </div> <PromotionNotification /> </div> - {footer} + <GlobalFooter /> </div> </StartupModal> </A11yProvider> |