From 7498059e9894026dc95ed36f446413fde7d94c3f Mon Sep 17 00:00:00 2001 From: Roman Komarov Date: Fri, 21 Feb 2020 15:03:27 +0100 Subject: [PATCH] useRowSelect: remove redundant checks (#1918) * useRowSelect: remove redundant checks * Update useRowSelect.js Co-authored-by: Tanner Linsley --- .size-snapshot.json | 12 ++++++------ src/plugin-hooks/useRowSelect.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.size-snapshot.json b/.size-snapshot.json index c323357..4f29fdb 100644 --- a/.size-snapshot.json +++ b/.size-snapshot.json @@ -1,13 +1,13 @@ { "dist/index.js": { - "bundled": 130976, - "minified": 61378, - "gzipped": 15745 + "bundled": 130947, + "minified": 61370, + "gzipped": 15740 }, "dist/index.es.js": { - "bundled": 130034, - "minified": 60537, - "gzipped": 15571, + "bundled": 130005, + "minified": 60529, + "gzipped": 15565, "treeshaked": { "rollup": { "code": 80, diff --git a/src/plugin-hooks/useRowSelect.js b/src/plugin-hooks/useRowSelect.js index 84ac385..01c3d74 100644 --- a/src/plugin-hooks/useRowSelect.js +++ b/src/plugin-hooks/useRowSelect.js @@ -136,9 +136,9 @@ function reducer(state, action, previousState, instance) { const row = rowsById[id] if (!row.isGrouped) { - if (!isSelected && shouldExist) { + if (shouldExist) { newSelectedRowIds[id] = true - } else if (isSelected && !shouldExist) { + } else { delete newSelectedRowIds[id] } }