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

fix(www): avoid querying for no-cache=1 #10389

Merged
merged 1 commit into from
Dec 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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