8000 docs: `retryLink` guide should mention that user needs to set `QueryClient` `defaultOptions.retry` to false · Issue #6189 · trpc/trpc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

docs: retryLink guide should mention that user needs to set QueryClient defaultOptions.retry to false #6189

Open
1 task
Senbonzakura1234 opened this issue Nov 4, 2024 · 6 comments
Labels
📚 documentation / examples Improvements or additions to documentation

Comments

@Senbonzakura1234
Copy link
Senbonzakura1234 commented Nov 4, 2024

Area of Improvement

Right now if user didn't set QueryClient defaultOptions.retry to false, trpc will automatically fallback to this retry property's default value (which is 4) and ignore the return value of retryLink.retry function.

Either clarifying this in the docs or this is a bug, trpc should prioritize retrun value of retryLink.retry function over QueryClient defaultOptions.retry.

Link to related docs

https://trpc.io/docs/client/links/retryLink

Additional information

package.json:

{
	"@tanstack/react-query": "^5.59.18",
	"@tanstack/react-query-devtools": "^5.59.18",
	"@trpc/client": "^11.0.0-rc.608",
	"@trpc/next": "^11.0.0-rc.608",
	"@trpc/react-query": "^11.0.0-rc.608",
	"@trpc/server": "^11.0.0-rc.608",
	"next": "^15.0.2",
	"react": "^18.3.1",
	"react-dom": "^18.3.1",
}

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR implementing the suggested changes!

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar
@Senbonzakura1234 Senbonzakura1234 added the 📚 documentation / examples Improvements or additions to documentation label Nov 4, 2024
@KATT
Copy link
Member
KATT commented Nov 4, 2024

Did #6190 clarify it? We had a typo.

How come you use this if you use react-query?

@Senbonzakura1234
Copy link
Author
Senbonzakura1234 commented Nov 4, 2024

Did #6190 clarify it? We had a typo.

How come you use this if you use react-query?

Oh right i didn't see it. However as i check it seems the error object inQueryClient defaultOptions.retry don't have the type inference, it was just generic Error class. I can't check the http error.

While retryLink does have the type inference. @KATT

@KATT
Copy link
Member
KATT commented Nov 4, 2024

You can typecast it if you know it's a trpc error

@KATT
Copy link
Member
KATT commented Nov 4, 2024
import { TRPCClientError } from '@trpc/react-query';
import { TRPCBase } from '~/server/trpc';

export type ApiError = TRPCClientError<TRPCBase>;

export function isTRPCClientError(cause: unknown): cause is ApiError {
  return cause instanceof TRPCClientError;
}

@KATT
Copy link
Member
KATT commented Nov 4, 2024

Would love for something like that to be in the docs somewhere, would you be down to do a PR?

@Senbonzakura1234
Copy link
Author

Would love for something like that to be in the docs somewhere, would you be down to do a PR?

@KATT leme see if i have some free time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation / examples Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants
0