1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-04 01:18:20 +02:00

fix: useLocation instead of browser location for resolving pathname (#9640)

This commit is contained in:
David Leek 2025-03-28 08:54:21 +01:00 committed by GitHub
parent 7f98709730
commit 39755c7f19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import { useUiFlag } from 'hooks/useUiFlag';
import type { ReactNode } from 'react';
import { Sticky } from 'component/common/Sticky/Sticky';
import { AdminMenuNavigation } from './AdminNavigationItems';
import { useLocation } from 'react-router-dom';
const StyledAdminMainGrid = styled(Grid)(({ theme }) => ({
minWidth: 0, // this is a fix for overflowing flex
@ -56,6 +57,7 @@ interface IWrapIfAdminSubpageProps {
export const WrapIfAdminSubpage = ({ children }: IWrapIfAdminSubpageProps) => {
const newAdminUIEnabled = useUiFlag('adminNavUI');
const theme = useTheme();
const location = useLocation();
const isSmallScreen = useMediaQuery(theme.breakpoints.down('lg'));
const showAdminMenu =
!isSmallScreen &&

View File

@ -1,5 +1,5 @@
import type { VFC } from 'react';
import { Link } from 'react-router-dom';
import { Link, useLocation } from 'react-router-dom';
import { Divider, Drawer, styled } from '@mui/material';
import { ReactComponent as UnleashLogo } from 'assets/img/logoDarkWithText.svg';
import { ReactComponent as UnleashLogoWhite } from 'assets/img/logoWithWhiteText.svg';
@ -34,6 +34,7 @@ export const DrawerMenu: VFC<IDrawerMenuProps> = ({
toggleDrawer,
}) => {
const newAdminUIEnabled = useUiFlag('adminNavUI');
const location = useLocation();
const showOnlyAdminMenu =
newAdminUIEnabled && location.pathname.indexOf('/admin') === 0;
const onClick = () => {