Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Prod page] Add check to prevent errors if no feat. image exists #3429

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions assets/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -1154,9 +1154,11 @@ class VariantSelects extends HTMLElement {
});
}

document
.querySelector(`[id^="MediaGallery-${this.dataset.section}"]`)
?.setActiveMedia?.(`${this.dataset.section}-${this.currentVariant.featured_media?.id}`);
if (this.currentVariant.featured_media) {
document
.querySelector(`[id^="MediaGallery-${this.dataset.section}"]`)
?.setActiveMedia?.(`${this.dataset.section}-${this.currentVariant.featured_media?.id}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit -- we should be able to remove the optional chain here this.currentVariant.featured_media?.id since we already check that featured_media is preesent

}

// update media modal
const modalContent = document.querySelector(`#ProductModal-${this.dataset.section} .product-media-modal__content`);
Expand Down
Loading