fix(react-query-4,react-query-5): disable retry in QueriesHydration s…#1948
fix(react-query-4,react-query-5): disable retry in QueriesHydration s…#1948rjsdnql123 wants to merge 1 commit into
Conversation
|
People can be co-author:
|
|
@rjsdnql123 is attempting to deploy a commit to the Toss Team on Vercel. A member of the Team first needs to authorize it. |
| 'getNextPageParam' in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query) | ||
| 'getNextPageParam' in query | ||
| ? queryClient.fetchInfiniteQuery({ ...query, retry: 0 }) | ||
| : queryClient.fetchQuery({ ...query, retry: 0 }) |
There was a problem hiding this comment.
How about adding this option just on the server side?
Current solution would work both client and server side.
There was a problem hiding this comment.
QueriesHydration is an async function component that runs only on the server. If it is used in a client component ('use client'), it will cause an async component rendering error.
Therefore, retry: 0 is applied only on the server side, while useQuery on the client follows its own retry configuration:
- Server:
fetchQuery({ retry: 0 })→ stops immediately after the first failure - Client:
skipSsrOnError→useQuerymounts and retries based on its own retry settings
I might have misunderstood the review, so please feel free to correct me if anything is off.
I also tested this scenario, and confirmed that retries on the client are working as expected. If you could share the specific case you're referring to, I’d be happy to test it as well.
There was a problem hiding this comment.
Sorry for being late @rjsdnql123
If so, I think this is quite proper change.
How about you @manudeli
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1948 +/- ##
=========================================
+ Coverage 0 93.26% +93.26%
=========================================
Files 0 42 +42
Lines 0 668 +668
Branches 0 166 +166
=========================================
+ Hits 0 623 +623
- Misses 0 42 +42
- Partials 0 3 +3
🚀 New features to boost your workflow:
|
|
I think if a user explicitly sets retry, we should respect that setting. TanStack Query takes the same stance — it defaults retry to 0 on the server, but if the user provides an explicit value, it follows that instead. That said, QueriesHydration sits one layer of abstraction above TanStack Query — it always runs on the server (since it's an async component) and acts as a wrapper around fetchQuery. Given this narrower context, I do think there's room to justify enforcing SSR safety more proactively here. Still, silently overriding a user's explicit retry value can make debugging harder. What if we exposed this as a prop instead, so the user can opt in consciously? For example, a What do you think? @manudeli @kangju2000 @marshallku KOR제 생각에는 사용자가 `retry`를 명시했다면 이를 이행하는 것이 맞다고 생각합니다. TanStack Query도 동일한 설정이에요. 서버에서 retry default를 0으로 보장하지만, 사용자가 명시한 경우엔 그 설정을 따릅니다.다만 그럼에도 사용자 명시값을 override하는 건 디버깅을 어렵게 만들 수 있어서, 어떻게 생각하세요? |
Hi Suspensive team,
Thanks for the great library!
Overview
Issue #1895
What
Force retry: 0 when calling fetchQuery and fetchInfiniteQuery in QueriesHydration.
Why
If retries occur during server-side prefetching, the server component rendering becomes blocked for each retry attempt.
How
Explicitly set
retryto0for all query calls:fetchQuery({ ...query, retry: 0 })
fetchInfiniteQuery({ ...query, retry: 0 })
PR Checklist