Fix default list sorting (#5303)
* Fix default sorting for lists views * Linting
This commit is contained in:
parent
8a664c524c
commit
d99aa3192c
@ -47,7 +47,9 @@ export default class SortStore {
|
||||
@action restoreSavedOrder = () => {
|
||||
const order = this.getSavedOrder();
|
||||
|
||||
this.onChange(order);
|
||||
if (order) {
|
||||
this.onChange(order);
|
||||
}
|
||||
}
|
||||
|
||||
getSavedOrder = () => {
|
||||
|
@ -66,7 +66,7 @@ class Contracts extends Component {
|
||||
state = {
|
||||
addContract: false,
|
||||
deployContract: false,
|
||||
sortOrder: 'blockNumber',
|
||||
sortOrder: 'blockNumber:-1',
|
||||
searchValues: [],
|
||||
searchTokens: []
|
||||
}
|
||||
@ -121,18 +121,16 @@ class Contracts extends Component {
|
||||
}
|
||||
|
||||
renderSortButton () {
|
||||
const onChange = (sortOrder) => {
|
||||
this.setState({ sortOrder });
|
||||
};
|
||||
const { sortOrder } = this.state;
|
||||
|
||||
return (
|
||||
<ActionbarSort
|
||||
key='sortAccounts'
|
||||
id='sortContracts'
|
||||
order={ this.state.sortOrder }
|
||||
order={ sortOrder }
|
||||
metas={ META_SORT }
|
||||
showDefault={ false }
|
||||
onChange={ onChange }
|
||||
onChange={ this.handleSortChange }
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -239,6 +237,10 @@ class Contracts extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
handleSortChange = (sortOrder) => {
|
||||
this.setState({ sortOrder });
|
||||
}
|
||||
|
||||
onAddSearchToken = (token) => {
|
||||
const { searchTokens } = this.state;
|
||||
const newSearchTokens = uniq([].concat(searchTokens, token));
|
||||
|
Loading…
Reference in New Issue
Block a user