From 8abd73fa4fbdaf4a538ef8c869baa72ae759c7c1 Mon Sep 17 00:00:00 2001 From: Quentin Hibon Date: Thu, 8 Apr 2021 12:32:12 +0200 Subject: [PATCH] Do not search if normalized query is empty Fixes #5137 --- ts/state/ducks/search.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ts/state/ducks/search.ts b/ts/state/ducks/search.ts index 3a27d9c28308..253343a10685 100644 --- a/ts/state/ducks/search.ts +++ b/ts/state/ducks/search.ts @@ -247,6 +247,9 @@ function updateSearchTerm(query: string): UpdateSearchTermActionType { async function queryMessages(query: string, searchConversationId?: string) { try { const normalized = cleanSearchTerm(query); + if (normalized.length === 0) { + return []; + } if (searchConversationId) { return searchMessagesInConversation(normalized, searchConversationId);