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

React 18 Strict Mode extra iframes #98

Open
impaler opened this issue Aug 23, 2022 · 1 comment
Open

React 18 Strict Mode extra iframes #98

impaler opened this issue Aug 23, 2022 · 1 comment
Assignees

Comments

@impaler
Copy link

impaler commented Aug 23, 2022

We have seen this issue where React 18 and the <React.StrictMode/> using the latest 0.5.0 of this library produce an extra iframe to be added to the DOM on subsequent re-renders of the components.

  • This is only happening when navigating back and forth inside react-router routes
  • It never happens when the Chargebee components first render, refreshing the page the expected iframes work fine again
  • Without <React.StrictMode/> we cannot reproduce the issue, the tell was the production build didn't show the extra iframe

@cb-dinesh Searching this repo the check suggested here may actually be needed?

https://github.com/chargebee/chargebee-js-wrappers/pull/88/files#diff-6b55b160538cf712c4aeba71ac8cfd6abb5d3faf549fbc5f8eae35d3d73ea0e6

Seems the closing solution expects the destroy() to solve the handling of iframes removal etc? d4f8404#diff-6b55b160538cf712c4aeba71ac8cfd6abb5d3faf549fbc5f8eae35d3d73ea0e6R46. I not positive this issue is related, forgive me it's hard to create an isolated example that shows the issue easily.

Maybe this issue will save time from someone else searching. Thanks.

@damyco
Copy link

damyco commented Nov 17, 2023

Same here in Next.js, component will render twice:

image

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

No branches or pull requests

3 participants