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

refactor: TanStack Query V5 업데이트 #239

Merged
merged 7 commits into from
Feb 16, 2024

Conversation

bbearcookie
Copy link
Member

@bbearcookie bbearcookie commented Jan 18, 2024

🧩 이슈 번호

✅ 작업 사항

  • TanStack Query V5로 버전 업데이트
  • 쿼리 훅 queryOptions() 로 변경
    • 원래 쿼리 훅을 queryOptions로 바꿔놓을 생각까진 없었는데.. 특정 컴포넌트에서는 Suspense 방식으로 사용하고, 특정 컴포넌트에서는 일반 방식으로 사용하고 있었어서 v5의 인터페이스에서는 기존 코드가 작동하지 않았어요. (suspense: true 옵션이 사라졌기 때문..) 그래서 queryOptions으로 바꾸는 과정을 수행했어요.
    • 임시 방편으로 작업한 것이라, 추후에 직접 구현한 API와 대응하는 쿼리 옵션으로 새롭게 정리하는 작업이 필요해요.
  • 기존의 isLoading 필드를 V5에서 변경된 isPending 필드로 변경 대응하는 작업을 했어요.
  • queryClient 관련 함수의 쿼리 키 관련 v5 변경 사항 대응
queryClient.invalidateQueries(queryKey.posts.all); // (X) 기존 방식이지만, v5에서 사용 불가능
queryClient.invalidateQueries({ queryKey: queryKey.posts.all }); // (O) v5에서 사용 가능한 형식

쿼리 키를 부여하는 인터페이스가 v5에서 변경되었는데, 해당 부분에 대응하는 작업을 했어요.

👩‍💻 공유 포인트 및 논의 사항

테스트 코드가 없는 상황에서 마이그레이션을 진행하다보니, 놓친 부분이 있을까 걱정되긴 하네요..

@bbearcookie bbearcookie added the 🔨 Refactor 리팩토링 label Jan 18, 2024
@bbearcookie bbearcookie self-assigned this Jan 18, 2024
@bbearcookie bbearcookie merged commit 08c4cbe into main Feb 16, 2024
2 checks passed
@bbearcookie bbearcookie deleted the refactor/238-tanstack-query branch February 16, 2024 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 Refactor 리팩토링
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TanStack Query V5로 버전 업데이트
1 participant