mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
🐛 Force-display the preview button after render()
Some tests indicate, that the `ppcp-hidden` and `ppcp-enabled` events are not always triggered on some sites. As the preview button is refreshed during those events, it would stay hidden on those sites. Adding a delayed DOM show() call solves the issue in a slightly less-elegant way.
This commit is contained in:
parent
c0c4d8d514
commit
f759ca4573
1 changed files with 11 additions and 0 deletions
|
@ -129,6 +129,17 @@ class PreviewButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.createButton(previewButtonConfig);
|
this.createButton(previewButtonConfig);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Unfortunately, a hacky way that is required to guarantee that this preview button is
|
||||||
|
* actually visible after calling the `render()` method. On some sites, we've noticed that
|
||||||
|
* certain JS events (like `ppcp-hidden`) do not fire in the expected order. This causes
|
||||||
|
* problems with preview buttons not being displayed instantly.
|
||||||
|
*
|
||||||
|
* Using a timeout here will make the button visible again at the end of the current
|
||||||
|
* event queue.
|
||||||
|
*/
|
||||||
|
setTimeout(() => this.domWrapper.show());
|
||||||
}
|
}
|
||||||
|
|
||||||
remove() {
|
remove() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue