POC for retaining search results, would fix #398

This commit is contained in:
James Barnsley
2019-06-09 16:20:06 +12:00
parent 0c253cdb0b
commit 4a303917ef
4 changed files with 16 additions and 14 deletions

View File

@ -80485,8 +80485,8 @@ var Search = function (_React$Component) {
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.props.mopidyActions.clearSearchResults();
this.props.spotifyActions.clearSearchResults();
//this.props.mopidyActions.clearSearchResults();
//this.props.spotifyActions.clearSearchResults();
}
}, {
key: 'componentWillReceiveProps',
@ -80534,11 +80534,11 @@ var Search = function (_React$Component) {
this.props.uiActions.setWindowTitle("Search: " + term);
this.props.mopidyActions.clearSearchResults();
this.props.spotifyActions.clearSearchResults();
if (type && term) {
this.props.mopidyActions.clearSearchResults();
this.props.spotifyActions.clearSearchResults();
if (provider == 'mopidy' || this.props.mopidy_connected && this.props.uri_schemes_search_enabled) {
this.props.mopidyActions.getSearchResults(type, term);
}
@ -80930,8 +80930,9 @@ var Search = function (_React$Component) {
return _this7.setState({ term: term });
},
onSubmit: function onSubmit(term) {
return _this7.search(_this7.state.type, term);
return _this7.props.history.push('/search/' + _this7.state.type + '/' + term);
}
//onSubmit={term => this.search(this.state.type, term)}
}),
_react2.default.createElement(
'div',

File diff suppressed because one or more lines are too long

View File

@ -100,7 +100,7 @@
// Release details
// These are automatically injected to built HTML
var build = "1560052320";
var build = "1560052732";
var version = "3.38.0";
// Construct the script tag

View File

@ -45,8 +45,8 @@ class Search extends React.Component{
}
componentWillUnmount(){
this.props.mopidyActions.clearSearchResults();
this.props.spotifyActions.clearSearchResults();
//this.props.mopidyActions.clearSearchResults();
//this.props.spotifyActions.clearSearchResults();
}
componentWillReceiveProps(nextProps){
@ -83,11 +83,11 @@ class Search extends React.Component{
this.props.uiActions.setWindowTitle("Search: "+term);
this.props.mopidyActions.clearSearchResults();
this.props.spotifyActions.clearSearchResults();
if (type && term){
this.props.mopidyActions.clearSearchResults();
this.props.spotifyActions.clearSearchResults();
if (provider == 'mopidy' || (this.props.mopidy_connected && this.props.uri_schemes_search_enabled)){
this.props.mopidyActions.getSearchResults(type, term)
}
@ -380,7 +380,8 @@ class Search extends React.Component{
history={this.props.history}
term={this.state.term}
onBlur={term => this.setState({term: term})}
onSubmit={term => this.search(this.state.type, term)}
onSubmit={term => this.props.history.push(`/search/${this.state.type}/${term}`)}
//onSubmit={term => this.search(this.state.type, term)}
/>
<div className="content-wrapper">