From e634bd86799ae49361ddf22e445b6ce1834f41d8 Mon Sep 17 00:00:00 2001 From: liamcardenas Date: Tue, 13 Mar 2018 22:33:43 -0700 Subject: [PATCH] Fix sort --- src/renderer/component/fileList/view.jsx | 32 ++---------------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index 686665078..7afe8998d 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -13,36 +13,8 @@ class FileList extends React.PureComponent { }; this._sortFunctions = { - dateNew: fileInfos => - fileInfos.slice().sort((fileInfo1, fileInfo2) => { - const height1 = this.props.claimsById[fileInfo1.claim_id] - ? this.props.claimsById[fileInfo1.claim_id].height - : 0; - const height2 = this.props.claimsById[fileInfo2.claim_id] - ? this.props.claimsById[fileInfo2.claim_id].height - : 0; - if (height1 > height2) { - return -1; - } else if (height1 < height2) { - return 1; - } - return 0; - }), - dateOld: fileInfos => - fileInfos.slice().sort((fileInfo1, fileInfo2) => { - const height1 = this.props.claimsById[fileInfo1.claim_id] - ? this.props.claimsById[fileInfo1.claim_id].height - : 999999; - const height2 = this.props.claimsById[fileInfo2.claim_id] - ? this.props.claimsById[fileInfo2.claim_id].height - : 999999; - if (height1 < height2) { - return -1; - } else if (height1 > height2) { - return 1; - } - return 0; - }), + dateNew: fileInfos => [...fileInfos].reverse(), + dateOld: fileInfos => fileInfos, title: fileInfos => fileInfos.slice().sort((fileInfo1, fileInfo2) => { const title1 = fileInfo1.value