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

Lazily retrieve transaction from transaction storage #1108

Merged
merged 2 commits into from
Jun 14, 2023

Conversation

frederikprijck
Copy link
Member

@frederikprijck frederikprijck commented Jun 14, 2023

Changes

When an instance of Auth0Client is created, we create an instance of our internal TransactionManager, which instantly accesses the storage.

When using sessionStorage in browsers that have blocked cookies and site data, this will cause an error when calling the Auth0Client constructor, resulting in rendering issues in our React wrapper as mentioned here.

By lazily accessing the transaction, we avoid this error when the constructor is called, but instead it will throw when the transaction is actually accessed, which will be caught by our React SDK.

References

auth0/auth0-react#540

Checklist

This is done to not throw in the Auth0Client constructor when cookies and site data are disabled.
@frederikprijck frederikprijck marked this pull request as ready for review June 14, 2023 11:07
@frederikprijck frederikprijck requested a review from a team as a code owner June 14, 2023 11:07
@frederikprijck frederikprijck changed the title Lazily access transaction Lazily access transaction storage Jun 14, 2023
@frederikprijck frederikprijck changed the title Lazily access transaction storage Lazily retrieve transaction from transaction storage Jun 14, 2023
@frederikprijck frederikprijck merged commit f84351f into master Jun 14, 2023
13 checks passed
@frederikprijck frederikprijck deleted the fix/lazy-transaction branch June 14, 2023 13:41
@frederikprijck frederikprijck mentioned this pull request Jun 14, 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.

None yet

3 participants