File tree 2 files changed +13
-8
lines changed
2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ addProducts(5);
24
24
export default class DebounceSearchTable extends React . Component {
25
25
render ( ) {
26
26
const options = {
27
- searchDelayTime : 500
27
+ searchDelayTime : 3000
28
28
} ;
29
29
30
30
return (
Original file line number Diff line number Diff line change @@ -20,6 +20,15 @@ class ToolBar extends Component {
20
20
} ;
21
21
}
22
22
23
+ componentWillMount ( ) {
24
+ const delay = this . props . searchDelayTime ? this . props . searchDelayTime : 0 ;
25
+ this . debounceCallback = this . handleDebounce ( ( ) => {
26
+ this . props . onSearch ( this . refs . seachInput . value ) ;
27
+ } ,
28
+ delay
29
+ ) ;
30
+ }
31
+
23
32
componentWillUnmount ( ) {
24
33
this . clearTimeout ( ) ;
25
34
}
@@ -156,13 +165,9 @@ class ToolBar extends Component {
156
165
} ;
157
166
}
158
167
159
- handleKeyUp = ( ) => {
160
- const delay = this . props . searchDelayTime ? this . props . searchDelayTime : 0 ;
161
- this . handleDebounce ( ( ) => {
162
- this . props . onSearch ( this . refs . seachInput . value ) ;
163
- } ,
164
- delay
165
- ) ( ) ;
168
+ handleKeyUp = ( event ) => {
169
+ event . persist ( ) ;
170
+ this . debounceCallback ( event ) ;
166
171
}
167
172
168
173
handleExportCSV = ( ) => {
You can’t perform that action at this time.
0 commit comments