Skip to content

Commit e979d95

Browse files
authored
fix: 🐛 error on IE while running native findIndex (#80)
1 parent 2671fbd commit e979d95

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
/umd
77
npm-debug.log*
88
/gh-pages
9-
package-lock.json
9+
package-lock.json
10+
yarn-error.log

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"classnames": "^2.2.5",
2626
"lodash": "^4.17.4",
2727
"lodash.debounce": "^4.0.8",
28+
"lodash.findindex": "^4.6.0",
2829
"lodash.isequal": "^4.5.0",
2930
"lodash.omit": "^4.5.0",
3031
"material-icons": "^0.1.0",

src/selectors/nodes.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {createSelector} from 'reselect';
22
import omit from 'lodash.omit';
3+
import findIndex from 'lodash.findindex';
34

45
import {UPDATE_TYPE} from '../contants';
56

@@ -47,7 +48,7 @@ export const replaceNodeFromTree = (nodes, updatedNode, operation = NODE_OPERATI
4748
return NODE_CHANGE_OPERATIONS[operation](nodes, updatedNode);
4849
}
4950

50-
const parentIndex = nodes.findIndex(n => n.id === parents[0]);
51+
const parentIndex = findIndex(nodes, n => n.id === parents[0]);
5152
const preSiblings = nodes.slice(0, parentIndex);
5253
const postSiblings = nodes.slice(parentIndex + 1);
5354

@@ -94,4 +95,4 @@ export const addNode = node => ({
9495
type: UPDATE_TYPE.ADD,
9596
});
9697

97-
export const getRowIndexFromId = (flattenedTree, id) => flattenedTree.findIndex(node => node.id === id);
98+
export const getRowIndexFromId = (flattenedTree, id) => findIndex(flattenedTree, node => node.id === id);

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6191,6 +6191,11 @@ lodash.debounce@^4.0.8:
61916191
version "4.0.8"
61926192
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
61936193

6194+
lodash.findindex@^4.6.0:
6195+
version "4.6.0"
6196+
resolved "https://registry.yarnpkg.com/lodash.findindex/-/lodash.findindex-4.6.0.tgz#a3245dee61fb9b6e0624b535125624bb69c11106"
6197+
integrity sha1-oyRd7mH7m24GJLU1ElYku2nBEQY=
6198+
61946199
lodash.flattendeep@^4.4.0:
61956200
version "4.4.0"
61966201
resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2"

0 commit comments

Comments
 (0)