Skip to content

Commit f250fd9

Browse files
Merge pull request #7 from WebDevStudios/feature/debounce-input-field
Added debounce to input
2 parents e6f0e88 + d1d732f commit f250fd9

File tree

5 files changed

+34
-14
lines changed

5 files changed

+34
-14
lines changed

assets/js/components/searchForm.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import qs from 'query-string';
3+
import { DebounceInput } from 'react-debounce-input';
34
import SearchResults from './searchResults';
45

56
export default class SearchForm extends React.Component {
@@ -98,7 +99,7 @@ export default class SearchForm extends React.Component {
9899
render() {
99100
return (
100101
<div className={ `${ this.getFormClass() }` }>
101-
<input className="search-input" type="text" onChange={ this.getResults } placeholder={ wds_react_post_search.placeholder_text } />
102+
<DebounceInput debounceTimeout={ 300 } className="search-input" type="text" onChange={ this.getResults } placeholder={ wds_react_post_search.placeholder_text } />
102103
<SearchResults searched={ this.state.searched } loading={ this.state.loading } results={ this.state.results } lengthError={ this.state.lengthError } empty={ this.state.empty } />
103104
</div>
104105
)

assets/js/public.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

class-wds-react-post-search.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: WDS React Post Search
44
* Description: Power up the basic WordPress search with React.
55
* Plugin URI: https://www.webdevstudios.com
6-
* Version: 1.0.3
6+
* Version: 1.0.4
77
*
88
* With help from:
99
* https://www.ibenic.com/wordpress-react-search/

package-lock.json

Lines changed: 23 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wds-react-post-search",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "Power up the basic WordPress search field with React.",
55
"main": "assets/js/public.js",
66
"dependencies": {
@@ -12,7 +12,8 @@
1212
"install": "^0.12.2",
1313
"npm": "^6.4.1",
1414
"query-string": "^6.2.0",
15-
"react": "^16.5.2",
15+
"react": "^16.6.3",
16+
"react-debounce-input": "^3.2.0",
1617
"react-dom": "^16.5.2",
1718
"webpack": "^4.21.0"
1819
},

0 commit comments

Comments
 (0)