From 1d9e0a006bd24735628b532b64e8804fe35095ec Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 13 Sep 2023 12:01:21 +0100 Subject: [PATCH] Fix RoomView::onSearchClick toggle behaviour Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/RoomView.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index c6162b4d289..19bedabaa19 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -1784,12 +1784,13 @@ export class RoomView extends React.Component { }; private onSearchClick = (): void => { - this.setState({ - timelineRenderingType: - this.state.timelineRenderingType === TimelineRenderingType.Search - ? TimelineRenderingType.Room - : TimelineRenderingType.Search, - }); + if (this.state.timelineRenderingType === TimelineRenderingType.Search) { + this.onCancelSearchClick(); + } else { + this.setState({ + timelineRenderingType: TimelineRenderingType.Search, + }); + } }; private onCancelSearchClick = (): Promise => {