fix: clear search when change left pane modes

pull/3083/head
William Grant 11 months ago
parent 71cc46dfe4
commit 8918598a0a

@ -1,5 +1,6 @@
import { useDispatch, useSelector } from 'react-redux';
import styled from 'styled-components';
import { clearSearch } from '../../state/ducks/search';
import { resetLeftOverlayMode, setLeftOverlayMode } from '../../state/ducks/section';
import { getLeftOverlayMode } from '../../state/selectors/section';
import { SessionIcon } from '../icon';
@ -40,8 +41,10 @@ export const MenuButton = () => {
const isToggled = Boolean(leftOverlayMode);
const onClickFn = () =>
const onClickFn = () => {
dispatch(clearSearch());
dispatch(isToggled ? resetLeftOverlayMode() : setLeftOverlayMode('choose-action'));
};
return (
<StyledMenuButton data-testid="new-conversation-button" onClick={onClickFn}>

@ -1,5 +1,6 @@
import { useDispatch, useSelector } from 'react-redux';
import styled from 'styled-components';
import { clearSearch } from '../../state/ducks/search';
import {
SectionType,
setLeftOverlayMode,
@ -135,6 +136,9 @@ export const LeftPaneSectionHeader = () => {
const dispatch = useDispatch();
const returnToActionChooser = () => {
if (leftOverlayMode === 'closed-group') {
dispatch(clearSearch());
}
dispatch(setLeftOverlayMode('choose-action'));
};

Loading…
Cancel
Save