Skip to content

Commit

Permalink
Merge pull request #1827 from sacr3dc0w/master
Browse files Browse the repository at this point in the history
Reduce lodash usage in compare-products.js and image-gallery.js
  • Loading branch information
bookernath authored Oct 28, 2020
2 parents 6e5494b + d3928c2 commit 18ce009
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Reduce lodash usage in compare-products.js and image-gallery.js [#1827](https://github.com/bigcommerce/cornerstone/pull/1827)
- Fixed Product Image Carousel Becomes Responsiveness on Product Page. [#1879](https://github.com/bigcommerce/cornerstone/pull/1879)
- Move phrases and static strings to en.json for improving translation customizing. [#1850](https://github.com/bigcommerce/cornerstone/pull/1850)
- Update carousel images to improve LCP indicator from Lighthouse performance report. [#1876](https://github.com/bigcommerce/cornerstone/pull/1876)
Expand Down
3 changes: 1 addition & 2 deletions assets/js/theme/global/compare-products.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import _ from 'lodash';
import { showAlertModal } from './modal';

function decrementCounter(counter, item) {
Expand Down Expand Up @@ -33,7 +32,7 @@ export default function (urlContext) {
$('body').on('compareReset', () => {
const $checked = $('body').find('input[name="products\[\]"]:checked');

compareCounter = $checked.length ? _.map($checked, element => element.value) : [];
compareCounter = $checked.length ? $checked.map((index, element) => element.value).get() : [];
updateCounterNav(compareCounter, $compareLink, urlContext);
});

Expand Down
3 changes: 1 addition & 2 deletions assets/js/theme/product/image-gallery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'easyzoom';
import _ from 'lodash';

export default class ImageGallery {
constructor($gallery) {
Expand All @@ -15,7 +14,7 @@ export default class ImageGallery {
}

setMainImage(imgObj) {
this.currentImage = _.clone(imgObj);
this.currentImage = { ...imgObj };

this.setActiveThumb();
this.swapMainImage();
Expand Down

0 comments on commit 18ce009

Please sign in to comment.