mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -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 Page = require('../../components/page/www/page.jsx');
|
||||||
const render = require('../../lib/render.jsx');
|
const render = require('../../lib/render.jsx');
|
||||||
|
|
||||||
const ACCEPTABLE_MODES = ['trending', 'popular', ''];
|
const ACCEPTABLE_MODES = ['trending', 'popular'];
|
||||||
|
|
||||||
require('./search.scss');
|
require('./search.scss');
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class Search extends React.Component {
|
||||||
this.state = this.getSearchState();
|
this.state = this.getSearchState();
|
||||||
this.state.loaded = [];
|
this.state.loaded = [];
|
||||||
this.state.loadNumber = 16;
|
this.state.loadNumber = 16;
|
||||||
this.state.mode = '';
|
this.state.mode = 'popular';
|
||||||
this.state.offset = 0;
|
this.state.offset = 0;
|
||||||
this.state.loadMore = false;
|
this.state.loadMore = false;
|
||||||
|
|
||||||
|
@ -51,7 +51,10 @@ class Search extends React.Component {
|
||||||
mode = mode.substring(0, mode.indexOf('&'));
|
mode = mode.substring(0, mode.indexOf('&'));
|
||||||
}
|
}
|
||||||
mode = decodeURIComponent(mode.split('+').join(' '));
|
mode = decodeURIComponent(mode.split('+').join(' '));
|
||||||
this.state.mode = mode;
|
if (ACCEPTABLE_MODES.indexOf(mode) !== -1) {
|
||||||
|
this.state.mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
const query = window.location.search;
|
const query = window.location.search;
|
||||||
|
|
Loading…
Reference in a new issue