From 2f9308baaba3ced26a8f79862c346ae902f5ab0d Mon Sep 17 00:00:00 2001 From: beom Date: Wed, 20 Nov 2024 15:37:01 +0900 Subject: [PATCH] =?UTF-8?q?!HOTFIX=20:=20=EA=B2=80=EC=83=89=20=ED=8F=BC=20?= =?UTF-8?q?=EC=9E=AC=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/layouts/SearchBar/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/layouts/SearchBar/index.tsx b/src/components/layouts/SearchBar/index.tsx index b6192cd..5851003 100644 --- a/src/components/layouts/SearchBar/index.tsx +++ b/src/components/layouts/SearchBar/index.tsx @@ -36,7 +36,6 @@ const SearchBar = ({ includeBack = true, includeFavorite = false, goBack }: Sear }, }); - // 현재 경로가 검색 결과 페이지가 아닐 때 쿼리 파라미터 제거 useEffect(() => { if (!location.pathname.includes(RouterPath.results) && searchParams.has('query')) { setSearchParams({}); @@ -80,12 +79,13 @@ const SearchBar = ({ includeBack = true, includeFavorite = false, goBack }: Sear } localStorage.setItem(SEARCH_ARRAY_KEY, JSON.stringify(searchArray)); - - // 검색 실행 + setSearchParams({ query: searchWord }); navigate(`/${RouterPath.results}?query=${currentSearchWord}`); } }; + const nowSearchWord = watch('searchWord'); + return ( {includeBack && } @@ -97,7 +97,7 @@ const SearchBar = ({ includeBack = true, includeFavorite = false, goBack }: Sear {...register('searchWord')} onClick={() => setIsModalOpen(true)} /> - {searchWord?.trim().length > 0 && } + {nowSearchWord?.trim().length > 0 && } {includeFavorite && }