mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
🩹 FIx potential problem with initialization order
This commit is contained in:
parent
72b9fdc251
commit
2fa5545af2
1 changed files with 6 additions and 6 deletions
|
@ -732,12 +732,11 @@ export default class PaymentButton {
|
||||||
* Only relevant on the checkout page, i.e., when `this.isSeparateGateway` is `true`
|
* Only relevant on the checkout page, i.e., when `this.isSeparateGateway` is `true`
|
||||||
*/
|
*/
|
||||||
showPaymentGateway() {
|
showPaymentGateway() {
|
||||||
if ( this.#gatewayInitialized ) {
|
if (
|
||||||
return;
|
this.#gatewayInitialized ||
|
||||||
}
|
! this.isSeparateGateway ||
|
||||||
this.#gatewayInitialized = true;
|
! this.isEligible
|
||||||
|
) {
|
||||||
if ( ! this.isSeparateGateway || ! this.isEligible ) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -753,6 +752,7 @@ export default class PaymentButton {
|
||||||
.forEach( ( el ) => el.remove() );
|
.forEach( ( el ) => el.remove() );
|
||||||
|
|
||||||
this.log( 'Show gateway' );
|
this.log( 'Show gateway' );
|
||||||
|
this.#gatewayInitialized = true;
|
||||||
|
|
||||||
// This code runs only once, during button initialization, and fixes the initial visibility.
|
// This code runs only once, during button initialization, and fixes the initial visibility.
|
||||||
this.isVisible = this.isCurrentGateway;
|
this.isVisible = this.isCurrentGateway;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue