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

fix(auth): Fix willAuthError not being called on waiting operations #3017

Merged
merged 3 commits into from
Mar 7, 2023

Conversation

kitten
Copy link
Member

@kitten kitten commented Mar 7, 2023

Summary

When operations are waiting for authPromise to resolve, i.e. they're not queued but instead are waiting for the authentication update/refresh to resolve, willAuthError will actually not be called, even if it's provided.

This can lead to an easy mistake, where the authentication state may have been rehydrated (on startup), but is never checked to be valid.

We now queue operations that are waiting for the promise like we do for failed operations, which simplifies the logic a little, and make sure to call willAuthError on them again.

Set of changes

  • Call willAuthError on queued retry operations
  • Reuse queue for waiting operations
  • Update how mutate bypasses the authentication logic

@kitten kitten merged commit 64319ec into main Mar 7, 2023
@kitten kitten deleted the fix/auth-race-init branch March 7, 2023 16:57
This was referenced Mar 7, 2023
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

Successfully merging this pull request may close these issues.

2 participants