Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live search #79

Merged
merged 9 commits into from
Feb 7, 2019
Merged

Live search #79

merged 9 commits into from
Feb 7, 2019

Conversation

JasonStoltz
Copy link
Member

@JasonStoltz JasonStoltz commented Feb 6, 2019

Live Search

Finishes #74

latest

react-search-ui

<SearchBox
  searchAsYouType={true}
  debounceLength={500}
 />
  • Added a searchAsYouType option to SearchBox that will perform requests as input is entered
  • Added a debounce option to SearchBox to let a user balance the number of requests made to the server vs. how responsive the SearchBox is.
  • Moved the SearchBox input value to be managed globally in the searchTerm state field, which lets the SearchBox be cleared from outside (like via a reset action), and also sets us up for query suggestions.

search-ui

setSearchTerm("a term", {
  refresh: true,
  debounce: 500
})
  • Added a refresh and debounce option to setSearchTerm action which correspond to the searchAsYouType and debounce options on the SearchBox.
  • Debouncing URL state changes across the board to avoid getting an over abundance of URL state changes in browser history.
  • Added "sequencing" to API calls so that old API calls are ignored if responses come back from the server out of order. This is especially a problem for the "Live Search" feature.
  • Refactored tests.
  • Updated setSearchTerm so that multiple calls to setSearchTerm can be made in quick succession. If a previous operation has actions locked, setSearchTerm will disregard that and make the request anyway. Other actions will respect an "isLoading" flag that disallows another action to be made before the previous action has completed.

@JasonStoltz JasonStoltz added the WIP label Feb 6, 2019
@JasonStoltz JasonStoltz removed the WIP label Feb 6, 2019
scottybollinger
scottybollinger previously approved these changes Feb 6, 2019
Copy link
Contributor

@scottybollinger scottybollinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of optional copy changes but LGTM otherwise!

packages/react-search-ui/README.md Outdated Show resolved Hide resolved
packages/react-search-ui/README.md Outdated Show resolved Hide resolved
packages/search-ui/src/RequestSequencer.js Show resolved Hide resolved
@JasonStoltz
Copy link
Member Author

Good points @scottybollinger. Mind re-reviewing?

@JasonStoltz JasonStoltz merged commit 9f4c2ba into elastic:master Feb 7, 2019
@JasonStoltz JasonStoltz deleted the live-search branch February 7, 2019 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants