Refactor/#414-B: query 중복 코드 useWorkspaceQuery 적용 #415
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤠 개요
💫 설명
같은 query 로직이 흩어져 있을 때 이런 문제가 발생할 수 있어요!
queryKey
를 잘못 쓸 수 있음queryFn
을 잘못 쓸 수 있음따라서 해당 로직을
useWorkspaceQuery
훅에서 관리해 똑같은 동작을 보장해요.client/src/pages/Workspace/index.tsx
여기도getWorkspace
를 호출하고 있더라구요🌜 고민거리 (Optional)
Q. 테스트코드 써볼까요?
client/src/pages/Workspace/index.tsx
같이 로직이 좀 있는 걸 고치려면 테스트 코드가 있어야 할 것 같아요.📷 스크린샷 (Optional)