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: useCallback to define retryCsrfRequest to avoid infinite loop #2259

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

blushi
Copy link
Member

@blushi blushi commented Jan 11, 2024

Description

Closes: #2258

As part of #2252 which introduced this bug, retryCsrfRequest was added to the dependency array of the login callback. Because retryCsrfRequest wasn't declared with useCallback and always changing, this was causing the useEffect in useAutoConnect (which indirectly depends on login that depends on retryCsrfRequest) to trigger indefinitely, eventually causing the app to error.
This issue was reproducible when logging in with an account that has a wallet address (which triggers tryConnectWallet in useAutoConnect) and then going to another page or reloading the app.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • provided a link to the relevant issue or specification
  • provided instructions on how to test
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

How to test

  1. Log in with an account with a wallet address
  2. Navigate the app, reload the app to make sure that the app error doesn't happen anymore

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items
.

I have...

  • confirmed all author checklist items have been addressed
  • reviewed code correctness and readability
  • verified React components follow DRY principles
  • reviewed documentation is accurate
  • reviewed tests
  • manually tested (if applicable)

Copy link

netlify bot commented Jan 11, 2024

Deploy Preview for regen-website ready!

Name Link
🔨 Latest commit 7ce97a8
🔍 Latest deploy log https://app.netlify.com/sites/regen-website/deploys/659feef2444a8f0009feb796
😎 Deploy Preview https://deploy-preview-2259--regen-website.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 configuration.

@blushi blushi requested a review from a team January 11, 2024 13:39
@blushi
Copy link
Member Author

blushi commented Jan 11, 2024

@erikalogie you can test this on https://deploy-preview-2259--regen-marketplace.netlify.app/, see testing instructions above

@erikalogie
Copy link
Collaborator

I am not getting the error! Great work

@blushi blushi merged commit 8e84d3e into dev Jan 11, 2024
11 checks passed
@blushi blushi deleted the fix-2258-app-error branch January 11, 2024 14:58
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.

Application error happening randomly
3 participants