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

When using dbAuth, don't call getToken multiple times per page #5816

Merged
merged 21 commits into from
Jul 1, 2022

Conversation

cannikin
Copy link
Member

@cannikin cannikin commented Jun 23, 2022

This PR contains two separate strategies to mitigate the multiple getToken calls:

  1. If a call to getToken is already in progress, return that Promise rather than start a new one
  2. Whenver a getToken response is received from the server, the result is cached for 5 seconds

Thanks to @dac09 for bringing me back from the edge of losing my sanity while dealing with these Promises!

Closes #4739

@netlify
Copy link

netlify bot commented Jun 23, 2022

Deploy Preview for redwoodjs-docs ready!

Name Link
🔨 Latest commit 43fcd2e
🔍 Latest deploy log https://app.netlify.com/sites/redwoodjs-docs/deploys/62be2de51a34ce000982db45
😎 Deploy Preview https://deploy-preview-5816--redwoodjs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@cannikin cannikin marked this pull request as ready for review June 27, 2022 23:12
@cannikin cannikin added release:feature This PR introduces a new feature topic/auth labels Jun 27, 2022
@cannikin cannikin requested a review from dac09 June 27, 2022 23:14
@cannikin cannikin merged commit 2bfc152 into main Jul 1, 2022
@cannikin cannikin deleted the rc-dbauth-gettoken branch July 1, 2022 00:09
@redwoodjs-bot redwoodjs-bot bot added this to the next-release milestone Jul 1, 2022
@jtoar jtoar modified the milestones: next-release, v2.1.0 Jul 5, 2022
@jacebenson
Copy link
Contributor

Amazing work @cannikin thank you!

@pi0neerpat
Copy link
Contributor

Super happy about this one. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature This PR introduces a new feature topic/auth
Projects
Status: Archived
Development

Successfully merging this pull request may close these issues.

auth?method=getToken happening 5x per page request (using dbAuth)
5 participants