diff --git a/src/modules/MessageSearch/context/MessageSearchProvider.tsx b/src/modules/MessageSearch/context/MessageSearchProvider.tsx index 37a14ff27..491fb3db3 100644 --- a/src/modules/MessageSearch/context/MessageSearchProvider.tsx +++ b/src/modules/MessageSearch/context/MessageSearchProvider.tsx @@ -2,6 +2,7 @@ import React, { useRef, useState, useReducer, + useMemo, } from 'react'; import { SendbirdError } from '@sendbird/chat'; import type { MessageSearchQuery } from '@sendbird/chat/message'; @@ -104,7 +105,10 @@ const MessageSearchProvider: React.FC = (props: Mess { sdk, logger, messageSearchDispatcher }, ); - const requestString = useSearchStringEffect({ searchString: searchString ?? '' }, { messageSearchDispatcher }); + const _searchString = useMemo(() => { + return searchString ?? messageSearchQuery?.keyword ?? ''; + }, [searchString, messageSearchQuery?.keyword]); + const requestString = useSearchStringEffect({ searchString: _searchString }, { messageSearchDispatcher }); useGetSearchMessages( { currentChannel, channelUrl, requestString, messageSearchQuery, onResultLoaded, retryCount }, @@ -122,7 +126,7 @@ const MessageSearchProvider: React.FC = (props: Mess return (