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 => {