mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 07:38:07 -05:00
Merge pull request #2058 from LLK/hotfix/search-default-mode
[DEVELOP] Hotfix/search default mode
This commit is contained in:
commit
39aa73c095
1 changed files with 6 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue