From fa6a432c9de91a59b7bb35c738f4d76276393af2 Mon Sep 17 00:00:00 2001 From: infiinte-persistence Date: Wed, 10 Jun 2020 05:55:04 +0200 Subject: [PATCH] Make library view mode [Downloads|Purchases] persistent. Previously, the mode kept going back to 'Purchases' on every entry. --- ui/page/fileListDownloaded/view.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/page/fileListDownloaded/view.jsx b/ui/page/fileListDownloaded/view.jsx index 5016e00aa..bb8785d07 100644 --- a/ui/page/fileListDownloaded/view.jsx +++ b/ui/page/fileListDownloaded/view.jsx @@ -1,6 +1,7 @@ // @flow import * as ICONS from 'constants/icons'; import React, { useState } from 'react'; +import usePersistedState from 'effects/use-persisted-state'; import Button from 'component/button'; import ClaimList from 'component/claimList'; import Paginate from 'component/common/paginate'; @@ -43,7 +44,7 @@ function FileListDownloaded(props: Props) { fetchingMyPurchases, } = props; const loading = fetchingFileList || fetchingMyPurchases; - const [viewMode, setViewMode] = React.useState(VIEW_PURCHASES); + const [viewMode, setViewMode] = usePersistedState('library-view-mode', VIEW_PURCHASES); const [searchQuery, setSearchQuery] = useState(''); function handleInputChange(e) {