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

The counter retryCount in the onErrorRetry is not incremented #46

Open
mrfratello opened this issue Jun 5, 2024 · 0 comments
Open

The counter retryCount in the onErrorRetry is not incremented #46

mrfratello opened this issue Jun 5, 2024 · 0 comments

Comments

@mrfratello
Copy link

The following code always returns 1 and the retryCount parameter

const [query] = nanoquery({
  fetcher: () => Promise.reject(),
  onErrorRetry: ({ retryCount }) => {
    console.log(`retryCount: ${retryCount}`);
    return retryCount * 1_000;
  },
});

demo: https://codesandbox.io/p/sandbox/nanostories-query-react-replay-count-error-9ywyg2?file=%2Fsrc%2Fstore.ts%3A10%2C23

P.S.: Can you export the default handler onErrorCount? If this is done, then I will be able to set a limit on the number of repetitions of the request and leave the logic of the intervals between requests:

const [query] = nanoquery({
  onErrorRetry: (params) => params.retryCount > 3 ? null : defaultOnErrorRetry(params),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant