🦺 Add check for config that causes infinite loop

This commit is contained in:
Philipp Stracker 2024-06-07 21:12:34 +02:00
parent 33c6c06e85
commit 93f3e4e7ac
No known key found for this signature in database
2 changed files with 8 additions and 0 deletions

View file

@ -135,6 +135,10 @@ class ApplepayButton {
const { wrapper, ppcpButtonWrapper } = this.contextConfig();
const wrapper_id = '#' + wrapper;
if (wrapper_id === ppcpButtonWrapper) {
throw new Error(`[ApplePayButton] "wrapper" and "ppcpButtonWrapper" values must differ to avoid infinite loop. Current value: "${wrapper_id}"`);
}
const syncButtonVisibility = () => {
if (!this.isEligible) {
return;