Make library view mode [Downloads|Purchases] persistent.

Previously, the mode kept going back to 'Purchases' on every entry.
This commit is contained in:
infiinte-persistence 2020-06-10 05:55:04 +02:00 committed by Sean Yesmunt
parent bda2bdadf8
commit fa6a432c9d

View file

@ -1,6 +1,7 @@
// @flow // @flow
import * as ICONS from 'constants/icons'; import * as ICONS from 'constants/icons';
import React, { useState } from 'react'; import React, { useState } from 'react';
import usePersistedState from 'effects/use-persisted-state';
import Button from 'component/button'; import Button from 'component/button';
import ClaimList from 'component/claimList'; import ClaimList from 'component/claimList';
import Paginate from 'component/common/paginate'; import Paginate from 'component/common/paginate';
@ -43,7 +44,7 @@ function FileListDownloaded(props: Props) {
fetchingMyPurchases, fetchingMyPurchases,
} = props; } = props;
const loading = fetchingFileList || fetchingMyPurchases; const loading = fetchingFileList || fetchingMyPurchases;
const [viewMode, setViewMode] = React.useState(VIEW_PURCHASES); const [viewMode, setViewMode] = usePersistedState('library-view-mode', VIEW_PURCHASES);
const [searchQuery, setSearchQuery] = useState(''); const [searchQuery, setSearchQuery] = useState('');
function handleInputChange(e) { function handleInputChange(e) {