Skip to content

Commit

Permalink
Merge pull request #68 from xsolla/PAYMENTS-18509
Browse files Browse the repository at this point in the history
fix (PAYMENTS-18509): iframe loading twice
  • Loading branch information
ekireevxs authored Apr 2, 2024
2 parents 4f508ba + 752bc13 commit a804196
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/web-components/web-component.abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export abstract class WebComponentAbstract extends HTMLElement {
protected addEventListenerToElement(
element: Element,
eventType: string,
listener: (event: Event) => void
listener: (event: Event) => void,
): void {
element.addEventListener(eventType, listener);
this.eventListeners.push({ element, eventType, listener });
Expand All @@ -46,7 +46,7 @@ export abstract class WebComponentAbstract extends HTMLElement {
protected attributeChangedCallback(
name?: string,
oldValue?: string,
newValue?: string
newValue?: string,
): void {
this.render();
}
Expand Down
2 changes: 2 additions & 0 deletions src/features/headless-checkout/headless-checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export class HeadlessCheckout {
},
};

this.formSpy.formWasInit = false;

return this.postMessagesClient.send<Form>(msg, (message) =>
initFormHandler(message, (args?: unknown) => {
if (args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export class TextComponent extends SecureComponentAbstract {

protected connectedCallback(): void {
this.startLoadingComponentHandler();

if (!this.formSpy.formWasInit) {
this.formSpy.listenFormInit(() => this.getConfigFromInputName());
return;
Expand Down Expand Up @@ -87,7 +86,11 @@ export class TextComponent extends SecureComponentAbstract {
};

protected attributeChangedCallback(): void {
this.connectedCallback();
if (!this.inputName) {
return;
}

super.attributeChangedCallback();
}

protected getHtml(): string {
Expand Down

0 comments on commit a804196

Please sign in to comment.