Skip to content

Commit

Permalink
LPS-127459 Reset selected menu item when closing the sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
victorg1991 authored and brianchandotcom committed Feb 24, 2021
1 parent b0d1c69 commit 8b8f62f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import PropTypes from 'prop-types';
import React, {useEffect, useRef, useState} from 'react';

import {useConstants} from '../contexts/ConstantsContext';
import {useSelectedMenuItemId} from '../contexts/SelectedMenuItemIdContext';
import {
useSelectedMenuItemId,
useSetSelectedMenuItemId,
} from '../contexts/SelectedMenuItemIdContext';
import {useSetSidebarPanelId} from '../contexts/SidebarPanelIdContext';

export const SidebarPanelContent = ({
Expand All @@ -36,6 +39,7 @@ export const SidebarPanelContent = ({

const isMounted = useIsMounted();
const selectedMenuItemId = useSelectedMenuItemId();
const setSelectedMenuItemId = useSetSelectedMenuItemId();
const setSidebarPanelId = useSetSidebarPanelId();

const {portletId, redirect} = useConstants();
Expand Down Expand Up @@ -97,6 +101,7 @@ export const SidebarPanelContent = ({
confirmUnsavedChanges();
}

setSelectedMenuItemId(null);
setSidebarPanelId(null);
}}
>
Expand Down

0 comments on commit 8b8f62f

Please sign in to comment.