Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/react-query-4/src/QueriesHydration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ export async function QueriesHydration({
try {
const queriesPromise = Promise.all(
queries.map((query) =>
'getNextPageParam' in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)
'getNextPageParam' in query
? queryClient.fetchInfiniteQuery({ ...query, retry: 0 })
: queryClient.fetchQuery({ ...query, retry: 0 })
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding this option just on the server side?
Current solution would work both client and server side.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Server: fetchQuery({ retry: 0 }) → stops immediately after the first failure
  2. Client: skipSsrOnErroruseQuery mounts 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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for being late @rjsdnql123
If so, I think this is quite proper change.
How about you @manudeli

)
)
await (timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise)
Expand Down
4 changes: 3 additions & 1 deletion packages/react-query-5/src/QueriesHydration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ export async function QueriesHydration({
try {
const queriesPromise = Promise.all(
queries.map((query) =>
'getNextPageParam' in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)
'getNextPageParam' in query
? queryClient.fetchInfiniteQuery({ ...query, retry: 0 })
: queryClient.fetchQuery({ ...query, retry: 0 })
)
)
await (timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise)
Expand Down
Loading