Skip to content

Commit 4f66e30

Browse files
committed
Handle searchQuery values that are objects or arrays
1 parent d47226e commit 4f66e30

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-sortable-tree",
3-
"version": "0.0.10",
3+
"version": "0.1.0",
44
"description": "Drag-and-drop sortable representation of hierarchical data",
55
"scripts": {
66
"build": "npm run lint && npm run test && npm run build:demo && npm run build:umd",
@@ -31,6 +31,7 @@
3131
],
3232
"license": "MIT",
3333
"dependencies": {
34+
"lodash.isequal": "^4.4.0",
3435
"react-dnd": "^2.1.4",
3536
"react-dnd-html5-backend": "^2.1.2",
3637
"react-virtualized": "^8.0.4"

src/react-sortable-tree.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import React, { Component, PropTypes } from 'react';
88
import { AutoSizer, List } from 'react-virtualized';
9+
import isEqual from 'lodash.isequal';
910
import 'react-virtualized/styles.css';
1011
import TreeNode from './tree-node';
1112
import NodeRendererDefault from './node-renderer-default';
@@ -115,7 +116,7 @@ class ReactSortableTree extends Component {
115116
swapDepth: null,
116117
rows: this.getRows(nextProps.treeData),
117118
});
118-
} else if (this.props.searchQuery !== nextProps.searchQuery) {
119+
} else if (!isEqual(this.props.searchQuery, nextProps.searchQuery)) {
119120
this.search(nextProps);
120121
} else if (this.props.searchFocusOffset !== nextProps.searchFocusOffset) {
121122
this.search(nextProps, true, true, true);

0 commit comments

Comments
 (0)