Skip to content

Commit

Permalink
fix(www): avoid querying for no-cache=1 (#10389)
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroenv authored and pieh committed Dec 12, 2018
1 parent f2b1821 commit 45d2832
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions www/src/components/plugin-searchbar-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,6 @@ injectGlobal`

// Search shows a list of "hits", and is a child of the PluginSearchBar component
class Search extends Component {
constructor(props, context) {
super(props)
}

render() {
return (
<div
Expand Down Expand Up @@ -253,7 +249,7 @@ class Search extends Component {
<Result
hit={result.hit}
pathname={this.props.pathname}
search={this.props.searchState}
query={this.props.query}
/>
)}
/>
Expand Down Expand Up @@ -415,7 +411,8 @@ class PluginSearchBar extends Component {

urlToSearch = () => {
if (this.props.location.search) {
return this.props.location.search.slice(2)
// ignore this automatically added query parameter
return this.props.location.search.replace(`no-cache=1`, ``).slice(2)
}
return ``
}
Expand All @@ -426,7 +423,7 @@ class PluginSearchBar extends Component {
})
}

onSearchStateChange(searchState) {
onSearchStateChange = searchState => {
this.updateHistory(searchState)
this.setState({ searchState })
}
Expand All @@ -439,11 +436,11 @@ class PluginSearchBar extends Component {
appId="OFCNCOG2CU"
indexName="npm-search"
searchState={this.state.searchState}
onSearchStateChange={this.onSearchStateChange.bind(this)}
onSearchStateChange={this.onSearchStateChange}
>
<Search
pathname={this.props.location.pathname}
searchState={this.state.searchState.query}
query={this.state.searchState.query}
/>
</InstantSearch>
</div>
Expand Down

0 comments on commit 45d2832

Please sign in to comment.