From f960d45c4eb501f361d158446445d315a282c4ef Mon Sep 17 00:00:00 2001 From: Er Myril Date: Wed, 25 Dec 2019 19:41:25 +0300 Subject: [PATCH] Added extra checking for existence of oldIndicies --- dist/index.es.js | 2 +- dist/index.js | 2 +- src/util.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/index.es.js b/dist/index.es.js index 13342d5..c185eba 100644 --- a/dist/index.es.js +++ b/dist/index.es.js @@ -151,7 +151,7 @@ function handleStateAdd(normalized, list) { return newList; } function getMode(evt) { - if (evt.oldIndicies.length > 0) + if (evt.oldIndicies && evt.oldIndicies.length > 0) return "multidrag"; if (evt.swapItem) return "swap"; diff --git a/dist/index.js b/dist/index.js index d6b6d4d..40701dd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -157,7 +157,7 @@ function handleStateAdd(normalized, list) { return newList; } function getMode(evt) { - if (evt.oldIndicies.length > 0) + if (evt.oldIndicies && evt.oldIndicies.length > 0) return "multidrag"; if (evt.swapItem) return "swap"; diff --git a/src/util.ts b/src/util.ts index d317276..2368e1b 100644 --- a/src/util.ts +++ b/src/util.ts @@ -124,7 +124,7 @@ export function handleStateAdd( } export function getMode(evt: MultiDragEvent) { - if (evt.oldIndicies.length > 0) return "multidrag"; + if (evt.oldIndicies && evt.oldIndicies.length > 0) return "multidrag"; if (evt.swapItem) return "swap"; return "normal"; }