Skip to content

Commit 570f8fa

Browse files
committed
Prevent button re-rendering during resume flow in single product context
1 parent 0bd86d6 commit 570f8fa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/ppcp-button/resources/js/modules/ContextBootstrap/SingleProductBootstrap.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import SimulateCart from '../Helper/SimulateCart';
88
import { strRemoveWord, strAddWord, throttle } from '../Helper/Utils';
99
import merge from 'deepmerge';
1010
import { debounce } from '../../../../../ppcp-blocks/resources/js/Helper/debounce';
11+
import ResumeFlowHelper from '../Helper/ResumeFlowHelper';
1112

1213
class SingleProductBootstrap {
1314
constructor( gateway, renderer, errorHandler ) {
@@ -53,7 +54,10 @@ class SingleProductBootstrap {
5354
return;
5455
}
5556

56-
this.render();
57+
// Avoid re-rendering during the resume flow to prevent duplicate onApprove callbacks.
58+
if ( ! ResumeFlowHelper.isResumeFlow() ) {
59+
this.render();
60+
}
5761

5862
this.renderer.enableSmartButtons( this.gateway.button.wrapper );
5963
show( this.gateway.button.wrapper );

0 commit comments

Comments
 (0)