chargebee / chargebee-js-wrappers

25 stars 10 forks source link

React 18 Strict Mode extra iframes #98

Open impaler opened 2 years ago

impaler commented 2 years ago

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.

@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? https://github.com/chargebee/chargebee-js-wrappers/commit/d4f8404e3e2fcdbdab702184ecab26c0dcf22675#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 commented 1 year ago

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

image