Skip to content

Commit

Permalink
fix: duplicate component rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-sourabh committed Oct 14, 2024
1 parent 0537fd8 commit 1ead67b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chargebee-js-react/src/components/ComponentGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export default class ChargebeeComponents extends React.Component<ChargebeeCompon
const cbInstance = Chargebee.getInstance();
cbInstance.load("components").then(() => {
let cbComponent = cbInstance.createComponent(type, options)
//cbComponent.mount(`#${this.id}`);
// Attach listeners if specified (only applicable for combined field)
if(onReady) cbComponent.on('ready', onReady);
if(onBlur) cbComponent.on('blur', onBlur);
Expand All @@ -100,6 +101,11 @@ export default class ChargebeeComponents extends React.Component<ChargebeeCompon
})
});
}
componentWillUnmount() {
const { cbComponent } = this.state;
cbComponent?.destroy();
}


tokenize(additionalData: AdditionalData) {
const { cbComponent } = this.state;
Expand Down

0 comments on commit 1ead67b

Please sign in to comment.