From 41f702787f75ffc42bb97206bffeca37931a9d36 Mon Sep 17 00:00:00 2001 From: Eugene Kasimov <105315663+eugenekasimov@users.noreply.github.com> Date: Mon, 24 Jul 2023 06:17:41 -0700 Subject: [PATCH] Fix an error (#2903) --- assets/quick-order-list.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/quick-order-list.js b/assets/quick-order-list.js index 9b43ea75ed1..7a597594774 100644 --- a/assets/quick-order-list.js +++ b/assets/quick-order-list.js @@ -163,7 +163,7 @@ class QuickOrderList extends HTMLElement { renderSections(parsedState) { this.getSectionsToRender().forEach((section => { const sectionElement = document.getElementById(section.id); - if (sectionElement.parentElement.classList.contains('drawer')) { + if (sectionElement && sectionElement.parentElement && sectionElement.parentElement.classList.contains('drawer')) { parsedState.items.length > 0 ? sectionElement.parentElement.classList.remove('is-empty') : sectionElement.parentElement.classList.add('is-empty'); setTimeout(() => { @@ -284,9 +284,10 @@ class QuickOrderList extends HTMLElement { } else { this.updateMessage(-parseInt(quantityElement.dataset.cartQuantity)) } - }).catch(() => { + }).catch((error) => { this.querySelectorAll('.loading-overlay').forEach((overlay) => overlay.classList.add('hidden')); this.resetQuantityInput(id); + console.error(error); this.setErrorMessage(window.cartStrings.error); }) .finally(() => {