fix default sort
This commit is contained in:
@@ -11,6 +11,7 @@ const PROVIDER_NAMES = {
|
||||
facebook: 'Facebook',
|
||||
github: 'GitHub',
|
||||
};
|
||||
const DEFAULT_SORT = '-score';
|
||||
|
||||
module.exports = {
|
||||
BASE_URL,
|
||||
@@ -22,4 +23,5 @@ module.exports = {
|
||||
DEFAULT_LAST_COMMENTS_MAX,
|
||||
DEFAULT_MAX_COMMENT_SIZE,
|
||||
PROVIDER_NAMES,
|
||||
DEFAULT_SORT,
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { h, Component } from 'preact';
|
||||
import api from 'common/api';
|
||||
|
||||
import { BASE_URL, NODE_ID, COMMENT_NODE_CLASSNAME_PREFIX } from 'common/constants';
|
||||
import { BASE_URL, NODE_ID, COMMENT_NODE_CLASSNAME_PREFIX, DEFAULT_SORT } from 'common/constants';
|
||||
import { url } from 'common/settings';
|
||||
import store from 'common/store';
|
||||
|
||||
@@ -21,9 +21,9 @@ export default class Root extends Component {
|
||||
let sort;
|
||||
|
||||
try {
|
||||
sort = localStorage.getItem(LS_SORT_KEY);
|
||||
sort = localStorage.getItem(LS_SORT_KEY) || DEFAULT_SORT;
|
||||
} catch(e) {
|
||||
sort = '-score';
|
||||
sort = DEFAULT_SORT;
|
||||
}
|
||||
|
||||
this.state = {
|
||||
|
||||
Reference in New Issue
Block a user