-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
검색 기능 구현 #490
검색 기능 구현 #490
Conversation
…cafe into feat/489-search
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
검색 기능 구현하시느라 고생하셨습니다~! 확인 한번만 해주십셩
if (Object.keys(sanitizedSearchParams).length === 0) { | ||
return Promise.resolve([]); | ||
} | ||
return this.fetchJson<SearchedCafe[]>(`/cafes/search?${new URLSearchParams(sanitizedSearchParams).toString()}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿~ 좋습니다
|
||
const [isDetailEnabled, setIsDetailEnabled] = useState(false); | ||
|
||
const query = useDeferredValue(isDetailEnabled ? { searchName, searchAddress, searchMenu } : { searchName }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오홍...! useDeferredValue()를 이용하셨군요 👍🏻👍🏻👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 맞습니다~! useDeferredValue를 사용하면 fallback을 보여주는 대신 이전의 렌더를 보여주기 때문에 끊김이 없는 것처럼 보여 사용자 경험에 좋은 영향을 줄 수 있습니다
font-size: ${({ theme }) => theme.fontSize['2xl']}; | ||
`; | ||
|
||
const FormGroup = styled.fieldset` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
시맨틱 태그도 야무지게 사용을 하셨군요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그럼요~^^
if (Object.keys(sanitizedSearchParams).length === 0) { | ||
return Promise.resolve([]); | ||
} | ||
return this.fetchJson<SearchedCafe[]>(`/cafes/search?${new URLSearchParams(sanitizedSearchParams).toString()}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
근데 메서드 POST인데 { method: 'POST' }
이거 필요 없나용?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어떤게 POST라는 걸까용? 서버 측에선 GET으로 구현되어 있기 때문에 GET 을 사용하였습니당
|
||
return useSuspenseQuery<SearchedCafe[]>({ | ||
queryKey: ['searchCafes', query], | ||
retry: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
retry는 왜 fasle로 하셨나용?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
검색 결과 조회는 타이핑마다 일어나기 때문에 빈번히 요청합니다. 여기서 이전 타이핑의 조회 결과는 필요없기 때문에 굳이 retry로 가져올 필요는 없기 때문입니다~!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나이스 코드~ 고생고생^^
#️⃣ 연관된 이슈
close #489
📝 작업 내용
💬 리뷰 요구사항