yet-another-react-lightbox 3.15.4 → 3.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +9 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -268,12 +268,15 @@ function reducer(state, action) {
268
268
  return { slides, currentIndex, globalIndex, currentSlide, animation };
269
269
  }
270
270
  case "update":
271
- return {
272
- slides: action.slides,
273
- currentIndex: action.index,
274
- globalIndex: action.index,
275
- currentSlide: getSlideIfPresent(action.slides, action.index),
276
- };
271
+ if (action.slides !== state.slides || action.index !== state.currentIndex) {
272
+ return {
273
+ slides: action.slides,
274
+ currentIndex: action.index,
275
+ globalIndex: action.index,
276
+ currentSlide: getSlideIfPresent(action.slides, action.index),
277
+ };
278
+ }
279
+ return state;
277
280
  default:
278
281
  throw new Error(UNKNOWN_ACTION_TYPE);
279
282
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yet-another-react-lightbox",
3
- "version": "3.15.4",
3
+ "version": "3.15.5",
4
4
  "description": "Modern React lightbox component",
5
5
  "author": "Igor Danchenko",
6
6
  "license": "MIT",