nanostores/query

The counter `retryCount` in the `onErrorRetry` is not incremented

mrfratello opened this issue · 3 comments

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),
});