Skip to content

Commit

Permalink
!HOTFIX : 검색 폼 재수정
Browse files Browse the repository at this point in the history
  • Loading branch information
seung365 committed Nov 20, 2024
1 parent 110e23d commit 2f9308b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/layouts/SearchBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const SearchBar = ({ includeBack = true, includeFavorite = false, goBack }: Sear
},
});

// 현재 경로가 검색 결과 페이지가 아닐 때 쿼리 파라미터 제거
useEffect(() => {
if (!location.pathname.includes(RouterPath.results) && searchParams.has('query')) {
setSearchParams({});
Expand Down Expand Up @@ -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 (
<SearchBarWrapper>
{includeBack && <IconButton icon="arrow-back" onClick={handleClickBack} />}
Expand All @@ -97,7 +97,7 @@ const SearchBar = ({ includeBack = true, includeFavorite = false, goBack }: Sear
{...register('searchWord')}
onClick={() => setIsModalOpen(true)}
/>
{searchWord?.trim().length > 0 && <CancelIconButton onClick={handleRemoveSearchWord} />}
{nowSearchWord?.trim().length > 0 && <CancelIconButton onClick={handleRemoveSearchWord} />}
</InputBox>
{includeFavorite && <IconButton icon="favorite-default" />}
</SearchBarWrapper>
Expand Down

0 comments on commit 2f9308b

Please sign in to comment.