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 incognito pm update #10960

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Fix incognito pm update #10960

wants to merge 4 commits into from

Conversation

hdiniz
Copy link
Contributor

@hdiniz hdiniz commented Jan 29, 2025

@hdiniz hdiniz self-assigned this Jan 29, 2025
Copy link

vercel bot commented Jan 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
opencollective-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 4, 2025 1:21am

@hdiniz hdiniz marked this pull request as ready for review January 29, 2025 11:30
@hdiniz hdiniz requested review from Betree and SudharakaP January 29, 2025 11:30
Copy link
Member

@Betree Betree left a comment

Choose a reason for hiding this comment

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

Can we add some comments to explain what problems we're solving with the abortController?

@hdiniz
Copy link
Contributor Author

hdiniz commented Jan 30, 2025

Can we add some comments to explain what problems we're solving with the abortController?

Solves a case where the hook is called again during component render and a new payment intent is created with same parameters by the previously in-flight mutation call. This causes an unused payment intent on Stripe and rerenders the form with new state.

// If this hook is called again during component rerender and we still have a in-flight payment intent, abort it.
// Without the abort controller, we can get another payment intent created for a previous render that will be unused
// and will make the form render again with the setStripe, setPaymentIntent state changes. This also prevents generating
// to many incomplete payment intents on stripe
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// to many incomplete payment intents on stripe
// too many incomplete payment intents on stripe

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.

Adding a New Payment Method for Recurring Contribution - Incognito User
2 participants