fix: multiplied code exchange requests in strict mode #1012
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In current implementation with:
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](https://private-user-images.githubusercontent.com/57632531/246942671-34944354-330c-4e35-8d53-03e75d71bacb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI0MTc3NTcsIm5iZiI6MTcyMjQxNzQ1NywicGF0aCI6Ii81NzYzMjUzMS8yNDY5NDI2NzEtMzQ5NDQzNTQtMzMwYy00ZTM1LThkNTMtMDNlNzVkNzFiYWNiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MzElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzMxVDA5MTczN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVhNGIwMmE1NTFiYTNlYjkzOTFkNDRlOGNhNjY5ZmNiODgwMGNiNGQ2OTBiNzk4MDJkMjc1NTU2OWJkMzc0OGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ayP0iXk4XrT7U8kfmwr0dH6M7ddM1r-Ks2xvowLXudc)
isMountedRef
cannot be used as it will be updated during next useEffect:Fix: local guard variable is introduced: