Skip to content

Commit 67df758

Browse files
authored
feat: Fast & efficient search rendering with large tree ✨ (#102)
1 parent ae17f39 commit 67df758

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3072
-2710
lines changed

.babelrc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"presets": [["es2015", { "modules": false }], "stage-0", "react"],
3-
"plugins": [
4-
"transform-class-properties"
5-
],
3+
"plugins": ["transform-class-properties"],
64
"env": {
7-
"test": {
8-
"presets": ["es2015", "stage-0", "react"],
9-
"plugins": ["istanbul"]
10-
}
5+
"test": {
6+
"presets": ["es2015", "stage-0", "react"],
7+
"plugins": ["istanbul"]
8+
},
9+
"production": {
10+
"plugins": ["transform-react-remove-prop-types"]
1111
}
12-
}
12+
}
13+
}

.travis.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,25 @@ cache:
44
- node_modules
55
git:
66
depth: 3
7-
node_js:
8-
- '8'
9-
before_install:
10-
- npm install -g greenkeeper-lockfile@1
11-
install:
12-
- yarn install --ignore-engines
13-
before_script: greenkeeper-lockfile-update
14-
after_script: greenkeeper-lockfile-upload
15-
script:
16-
- yarn coveralls
17-
branches:
18-
except:
19-
- /^v\d+\.\d+\.\d+$/
207
jobs:
218
include:
9+
- stage: test
10+
node_js:
11+
- '8'
12+
before_install:
13+
- npm install -g greenkeeper-lockfile@1
14+
install:
15+
- yarn install --ignore-engines
16+
before_script: greenkeeper-lockfile-update
17+
after_script: greenkeeper-lockfile-upload
18+
script:
19+
- yarn coveralls
20+
branches:
21+
except:
22+
- /^v\d+\.\d+\.\d+$/
2223
# Define the release stage that runs semantic-release
2324
- stage: release
24-
if: branch = master
25+
if: (NOT type IN (pull_request)) AND (branch = master)
2526
node_js: lts/*
2627
# overwrite default `script` step to skip the tests
2728
script: echo "Deploying to npm ..."

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ The tree debounces key presses to avoid costly search calculations. The default
350350

351351
The dropdown renders only visible content and skips any nodes that are going to hidden from the user. E.g., if a parent node is not expanded, there is no point in rendering children since they will not be visible anyway.
352352

353-
Planned feature: Use [react-virtualized](https://github.com/bvaughn/react-virtualized) to take this to the next level.
353+
~~Planned feature: Use [react-virtualized](https://github.com/bvaughn/react-virtualized) to take this to the next level.~~ The search tree now uses infinite scroll, limiting search results to 100 items initially (more load seamlessly as you scroll) - this results in super fast rendering even with large number of nodes (see [#80](https://github.com/dowjones/react-dropdown-tree-select/issues/80)).
354354

355355
### Reducing costly DOM manipulations
356356

__snapshots__/src/index.test.js.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Generated by [AVA](https://ava.li).
9999
<input
100100
className="search"
101101
onBlur={Function {}}
102-
onChange={Function onInputChange {}}
102+
onChange={Function {}}
103103
onFocus={Function {}}
104104
placeholder="Choose..."
105105
type="text"
@@ -253,6 +253,7 @@ Generated by [AVA](https://ava.li).
253253
onAction={Function {}}
254254
onCheckboxChange={Function {}}
255255
onNodeToggle={Function {}}
256+
pageSize={100}
256257
searchModeOn={false}
257258
/>
258259
</div>

__snapshots__/src/index.test.js.snap

16 Bytes
Binary file not shown.

__snapshots__/src/input/index.test.js.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,26 @@ The actual snapshot is saved in `index.test.js.snap`.
44

55
Generated by [AVA](https://ava.li).
66

7-
## renders tags
7+
## renders input when no tags are passed
88

99
> Snapshot 1
1010
1111
<ul
1212
className="tag-list"
1313
>
14-
<li
15-
className="tag-item"
16-
key="tag-item-i1"
17-
>
18-
<Tag
19-
id="i1"
20-
label="l1"
21-
/>
22-
</li>
23-
<li
24-
className="tag-item"
25-
key="tag-item-i2"
26-
>
27-
<Tag
28-
id="i2"
29-
label="l2"
30-
/>
31-
</li>
3214
<li
3315
className="tag-item"
3416
>
3517
<input
3618
className="search"
37-
onChange={Function onInputChange {}}
19+
onChange={Function {}}
3820
placeholder="Choose..."
3921
type="text"
4022
/>
4123
</li>
42-
</ul
24+
</ul>
4325

44-
## renders input when no tags are passed
26+
## renders placeholder
4527

4628
> Snapshot 1
4729
@@ -53,31 +35,49 @@ Generated by [AVA](https://ava.li).
5335
>
5436
<input
5537
className="search"
56-
onChange={Function onInputChange {}}
57-
placeholder="Choose..."
38+
onChange={Function {}}
39+
placeholder="select something"
5840
type="text"
5941
/>
6042
</li>
61-
</ul
43+
</ul>
6244

63-
## renders placeholder
45+
## renders tags
6446

6547
> Snapshot 1
6648
6749
<ul
6850
className="tag-list"
6951
>
52+
<li
53+
className="tag-item"
54+
key="tag-item-i1"
55+
>
56+
<Tag
57+
id="i1"
58+
label="l1"
59+
/>
60+
</li>
61+
<li
62+
className="tag-item"
63+
key="tag-item-i2"
64+
>
65+
<Tag
66+
id="i2"
67+
label="l2"
68+
/>
69+
</li>
7070
<li
7171
className="tag-item"
7272
>
7373
<input
7474
className="search"
75-
onChange={Function onInputChange {}}
76-
placeholder="select something"
75+
onChange={Function {}}
76+
placeholder="Choose..."
7777
type="text"
7878
/>
7979
</li>
80-
</ul
80+
</ul>
8181

8282
## should render data attributes
8383

@@ -102,9 +102,9 @@ Generated by [AVA](https://ava.li).
102102
>
103103
<input
104104
className="search"
105-
onChange={Function onInputChange {}}
105+
onChange={Function {}}
106106
placeholder="Choose..."
107107
type="text"
108108
/>
109109
</li>
110-
</ul>
110+
</ul>
-11 Bytes
Binary file not shown.

__snapshots__/src/tag/index.test.js.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Generated by [AVA](https://ava.li).
1414
hello
1515
<button
1616
className="tag-remove"
17-
onClick={Function onClick {}}
17+
onClick={Function {}}
1818
type="button"
1919
>
2020
x
0 Bytes
Binary file not shown.

__snapshots__/src/tree-node/action.test.js.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Generated by [AVA](https://ava.li).
1010
1111
<i
1212
className="cn0-0-0"
13-
onClick={Function onClick {}}
13+
onClick={Function {}}
1414
title="action"
1515
>
1616
hello

0 commit comments

Comments
 (0)