Merge pull request #2058 from LLK/hotfix/search-default-mode

[DEVELOP] Hotfix/search default mode
This commit is contained in:
chrisgarrity 2018-08-30 11:12:34 -04:00 committed by GitHub
commit 39aa73c095
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,7 +18,7 @@ const Tabs = require('../../components/tabs/tabs.jsx');
const Page = require('../../components/page/www/page.jsx');
const render = require('../../lib/render.jsx');
const ACCEPTABLE_MODES = ['trending', 'popular', ''];
const ACCEPTABLE_MODES = ['trending', 'popular'];
require('./search.scss');
@ -34,7 +34,7 @@ class Search extends React.Component {
this.state = this.getSearchState();
this.state.loaded = [];
this.state.loadNumber = 16;
this.state.mode = '';
this.state.mode = 'popular';
this.state.offset = 0;
this.state.loadMore = false;
@ -51,7 +51,10 @@ class Search extends React.Component {
mode = mode.substring(0, mode.indexOf('&'));
}
mode = decodeURIComponent(mode.split('+').join(' '));
this.state.mode = mode;
if (ACCEPTABLE_MODES.indexOf(mode) !== -1) {
this.state.mode = mode;
}
}
componentDidMount () {
const query = window.location.search;