mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix: sidebar update active when navigated via command menu. (#7545)
Currently, if the location changes, it does not update the active item. I added useEffect to update the active item. This is required when the user navigates via the command menu.
This commit is contained in:
parent
51a2b3aa0e
commit
165f02a3a4
@ -1,5 +1,5 @@
|
||||
import { Box, styled } from '@mui/material';
|
||||
import { type FC, useState } from 'react';
|
||||
import { type FC, useState, useEffect } from 'react';
|
||||
import { useNavigationMode } from './useNavigationMode';
|
||||
import { ShowAdmin, ShowHide } from './ShowHide';
|
||||
import { useRoutes } from './useRoutes';
|
||||
@ -67,6 +67,10 @@ export const NavigationSidebar = () => {
|
||||
const { lastViewed: lastViewedFlags } = useLastViewedFlags();
|
||||
const showRecentFlags = mode === 'full' && lastViewedFlags.length > 0;
|
||||
|
||||
useEffect(() => {
|
||||
setActiveItem(initialPathname);
|
||||
}, [initialPathname]);
|
||||
|
||||
return (
|
||||
<StretchContainer>
|
||||
<NewInUnleash mode={mode} onMiniModeClick={() => setMode('full')} />
|
||||
|
Loading…
Reference in New Issue
Block a user