Skip to content
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

[Fix] useQuery를 통한 캐싱 오류 #1480

Open
siwolee opened this issue Aug 13, 2024 · 0 comments
Open

[Fix] useQuery를 통한 캐싱 오류 #1480

siwolee opened this issue Aug 13, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@siwolee
Copy link
Collaborator

siwolee commented Aug 13, 2024

Desc

useQuery를 사용하는 부분에서, 사용하는 다른 페이지로 넘어갈 때
staleTime 10분 이내임에도 불구하고 해당 api 재요청됨

Reproduce

  1. useUser 사용 페이지/agenda/{agendaKey} 앞뒤로 왔다갔다하면서 network 요청 info 확인
  2. useAgendaData 사용 페이지 /agenda/{agendaKey} 앞뒤로 왔다갔다 하면서 network 요청 agenda/?agendaKey 확인

Wanted

10분 이내에는 페이지를 이동하더라도 재요청이 일어나지 않는 것

Bug img / video

Image

Etc

  • _app.tsx QueryClient default option 시도
  • useAgendaInfo / useUser 동일한 옵션으로 시도
    {
      staleTime: 60 * 1000 * 10, // 10분 동안은 캐시를 사용
      cacheTime: 60 * 1000 * 10, // 10분 동안 캐시를 유지
      retry: 1, // 에러가 났을 때 1번 재시도
      refetchOnMount: false, // 페이지 진입 시에는 새로고침을 하지 않음
    }
@siwolee siwolee added the bug Something isn't working label Aug 13, 2024
@siwolee siwolee self-assigned this Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant