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 the setConnector race condition in next.js strictmode #105

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

jorgea-stripe
Copy link
Contributor

I discovered that if we:

  1. Create an element `document.create('stripe-connect-payments');
  2. Load connect.js

Then this element does not have our custom element code loaded. The part that is missing is connecting it to the DOM.

In this case (where setConnector is not defined and the element is not connected) we simply connect and disconnect the element to the DOM to trigger the custom element code in connect.js from loading.

@jorgea-stripe jorgea-stripe merged commit db0b379 into master Apr 2, 2024
2 checks passed
@jorgea-stripe jorgea-stripe deleted the jorgea/setconnector-race-condition branch April 2, 2024 17:40
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

2 participants