From fab9d91a0b953289a0f4a592d6986ffc7b2d6982 Mon Sep 17 00:00:00 2001 From: SaadYousaf Date: Mon, 22 Aug 2022 14:02:01 +0500 Subject: [PATCH] fix: resolve issues with search functionality --- src/components/Search.jsx | 22 ++++++++----------- src/components/SearchInfo.jsx | 2 +- src/discussions/learners/data/slices.js | 1 + src/discussions/messages.js | 5 +++++ src/discussions/posts/NoResults.jsx | 4 +++- .../posts/post-actions-bar/messages.js | 2 +- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/components/Search.jsx b/src/components/Search.jsx index 628011ef..1911d762 100644 --- a/src/components/Search.jsx +++ b/src/components/Search.jsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect, useMemo } from 'react'; +import React, { useContext, useEffect } from 'react'; import camelCase from 'lodash/camelCase'; import { useDispatch, useSelector } from 'react-redux'; @@ -22,18 +22,14 @@ function Search({ intl }) { const isPostSearch = ['posts', 'my-posts'].includes(page); const isTopicSearch = 'topics'.includes(page); let searchValue = ''; - - const currentValue = useMemo(() => { - let value = ''; - if (isPostSearch) { - value = postSearch; - } else if (isTopicSearch) { - value = topicSearch; - } else { - value = learnerSearch; - } - return value; - }, [isPostSearch, isTopicSearch, learnerSearch]); + let currentValue = ''; + if (isPostSearch) { + currentValue = postSearch; + } else if (isTopicSearch) { + currentValue = topicSearch; + } else { + currentValue = learnerSearch; + } const onClear = () => { dispatch(setSearchQuery('')); diff --git a/src/components/SearchInfo.jsx b/src/components/SearchInfo.jsx index 6c2e061f..1ac613f3 100644 --- a/src/components/SearchInfo.jsx +++ b/src/components/SearchInfo.jsx @@ -18,7 +18,7 @@ function SearchInfo({ return (
-