apollographql / apollo-feature-requests

🧑‍🚀 Apollo Client Feature Requests | (no 🐛 please).
Other
130 stars 7 forks source link

allow retryLink to expose retries to the client #393

Open thumbsupep opened 1 year ago

thumbsupep commented 1 year ago

When a query errors, the retryLink silently continues to poll without notifying the UI in any way until all retries are complete. The UI is thus unaware it is potentially is displaying out-of-date information, and has no way of showing the user some sort of "retrying in X seconds" or "number of retries:" message.

Adding an onRetry callback to queries would be a potential solution.

jerelmiller commented 1 year ago

Hey @thumbsupep 👋

Thanks for the request! To make sure I'm understanding the ask here, are you thinking the API would look something like this?

import { RetryLink } from "@apollo/client/link/retry";

const link = new RetryLink({
  onRetry() {
    // do something when it retries
  }
});