fix: sorting on 'library' page

This commit is contained in:
Sean Yesmunt 2019-06-20 00:06:16 -04:00
parent 8f6e5e7559
commit 68a18556bf

View file

@ -26,6 +26,7 @@ type Props = {
export default function ClaimList(props: Props) {
const { uris, headerAltControls, injectedItem, loading, persistedStorageKey, empty, meta, type, header } = props;
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
const sortedUris = uris && currentSort === SORT_NEW ? uris.slice().reverse() : uris;
const hasUris = uris && !!uris.length;
const sortedUris = (hasUris && (currentSort === SORT_NEW ? uris : uris.slice().reverse())) || [];