Fix GooglePay preview rendering race condition.

This commit is contained in:
Pedro Silva 2023-10-16 15:32:25 +01:00
parent 993191ff34
commit b38658aeeb
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
2 changed files with 4 additions and 2 deletions

View file

@ -83,6 +83,9 @@ import widgetBuilder from "../../../ppcp-button/resources/js/modules/Renderer/Wi
googlePayConfig = await widgetBuilder.paypal.Googlepay().config();
// We need to set bootstrapped here otherwise googlePayConfig may not be set.
bootstrapped = true;
let options;
while (options = buttonQueue.pop()) {
createButton(options.ppcpConfig);
@ -103,7 +106,6 @@ import widgetBuilder from "../../../ppcp-button/resources/js/modules/Renderer/Wi
const tryToBoot = () => {
if (!bootstrapped && paypalLoaded && googlePayLoaded) {
bootstrapped = true;
bootstrap();
}
}

View file

@ -16,7 +16,7 @@ document.addEventListener(
jQuery( '*[data-ppcp-display]' ).each( (index, el) => {
const rules = jQuery(el).data('ppcpDisplay');
console.log('rules', rules);
// console.log('rules', rules);
for (const rule of rules) {
displayManager.addRule(rule);