Skip to content

Commit

Permalink
Fix an error (#2903)
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenekasimov authored and KaichenWang committed Jul 26, 2023
1 parent ded1030 commit ae25554
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions assets/quick-order-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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(() => {
Expand Down

0 comments on commit ae25554

Please sign in to comment.