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: multiplied code exchange requests in strict mode #1012

Merged
merged 1 commit into from
Jun 20, 2023

Conversation

Ignatella
Copy link
Contributor

In current implementation with:

  • React: 18.2.0 strict mode
  • Identity Provider: IdentityServer4
  • Flow: authorization code + pkce

We experience multiplied authorization code exchange requests as a result of not handling simulation of component immediate unmounting and remounting in strict mode.
error-short

isMountedRef cannot be used as it will be updated during next useEffect:
order
order-console

Fix: local guard variable is introduced:

fixed

@Critteros
Copy link

Also facing the same issue

@codecov
Copy link

codecov bot commented Jun 20, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@1ab8e3c). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1012   +/-   ##
=======================================
  Coverage        ?   98.93%           
=======================================
  Files           ?        1           
  Lines           ?       94           
  Branches        ?       35           
=======================================
  Hits            ?       93           
  Misses          ?        1           
  Partials        ?        0           

Copy link
Member

@simenandre simenandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this!

It would be great to see a unit test on this at some point.

@simenandre simenandre merged commit 2118bb2 into bjerkio:main Jun 20, 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.

3 participants