boostcampwm-2022 / web18-PRV

논문 인용관계를 밤하늘의 별 처럼 표시해보자 🌟-🌟
https://paperef.com
143 stars 3 forks source link

7-9 [FE] [fix] 검색어 자동완성 api 오류 시 재요청이 되지 않던 오류 수정 #53

Closed Palwol closed 1 year ago

Palwol commented 1 year ago

개요

작업사항

리뷰 요청사항

test 방법

// frontend/src/components/Search.tsx
// line:38

  const { isLoading, data: autoCompletedItems } = useQuery<IAutoCompletedItem[]>(
    ['getAutoComplete', debouncedValue],
  // keyword: debouncedValue를 keyword: ''로 변경
    () => api.getAutoComplete({ keyword: '' }).then((res) => res.data),
    {
      enabled: !!(debouncedValue && debouncedValue.length >= 2),
      retry: 3,
    },
  );

위 코드의 api.getAutoComplete({ keyword: debouncedValue }) 부분을 api.getAutoComplete({ keyword: '' })로 변경하고 검색어를 입력하면 에러가 발생합니다. 에러 발생 후 재요청이 3번까지 이루어지는지 확인 부탁드립니다.