Skip to content

Commit

Permalink
#340-sidebar(bug)
Browse files Browse the repository at this point in the history
  • Loading branch information
Margarita22 committed May 26, 2024
1 parent a537d6c commit 9543289
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/features/SideBar/ui/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ const SideBar: FC<ISideBar> = ({
const [isActive, setIsActive] = useState(false)

useEffect(() => {
if (activeElement?.name === itemName) {
setIsActive(!isActive)
if (activeElement?.name === itemName && activeElement !== undefined) {
setIsActive(true)
} else if (branch) {
setIsActive(!isActive)
setIsActive(true)
} else {
setIsActive(false)
}
}, [activeElement?.slug, branch])

Expand Down

0 comments on commit 9543289

Please sign in to comment.