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

Updates to user should not update memoized getAccessToken* methods #213

Merged
merged 3 commits into from
Mar 25, 2021

Conversation

adamjmcgrath
Copy link
Contributor

@adamjmcgrath adamjmcgrath commented Mar 17, 2021

Description

Updates to the user from the Authorization Server should not require updates to the getAccessToken* memoized methods. (Thanks for the suggestion @xepps)

References

fixes #210

Testing

  • add a side effect that depends on getAccessTokenSilently, eg useEffect(() => console.log('changed'), [getAccessTokenSilently])
  • login
  • make a change to your user (eg name) in the tenant dashboard
  • call getAccessTokenSilently({ ignoreCache: true })
  • anything rendering the user name should change, but the side effect should not be called

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

@adamjmcgrath adamjmcgrath added the review:small Small review label Mar 17, 2021
@adamjmcgrath adamjmcgrath requested a review from a team as a code owner March 17, 2021 18:20
@adamjmcgrath adamjmcgrath mentioned this pull request Mar 23, 2021
3 tasks
@adamjmcgrath adamjmcgrath merged commit 0aa3277 into master Mar 25, 2021
@adamjmcgrath adamjmcgrath mentioned this pull request Mar 26, 2021
@evansims evansims deleted the token-user-dep branch July 5, 2022 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review:small Small review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A change to the user's data redeclares the getAccessToken method, cascading unnecessary renders
2 participants