From 2ee185548489799eec4ef560962adbc854e28f3c Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Sun, 30 Jun 2019 23:30:42 -0400 Subject: [PATCH] fix: homepage sort persistance --- src/ui/component/claimListDiscover/view.jsx | 6 +++--- src/ui/util/use-persisted-state.js | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ui/component/claimListDiscover/view.jsx b/src/ui/component/claimListDiscover/view.jsx index 74feee6fe..08af75482 100644 --- a/src/ui/component/claimListDiscover/view.jsx +++ b/src/ui/component/claimListDiscover/view.jsx @@ -39,9 +39,9 @@ type Props = { function ClaimListDiscover(props: Props) { const { doClaimSearch, uris, tags, loading, personal, injectedItem, meta, subscribedChannels } = props; - const [personalSort, setPersonalSort] = usePersistedState('file-list-trending:personalSort', SEARCH_SORT_YOU); - const [typeSort, setTypeSort] = usePersistedState('file-list-trending:typeSort', TYPE_TRENDING); - const [timeSort, setTimeSort] = usePersistedState('file-list-trending:timeSort', TIME_WEEK); + const [personalSort, setPersonalSort] = usePersistedState('claim-list-discover:personalSort', SEARCH_SORT_YOU); + const [typeSort, setTypeSort] = usePersistedState('claim-list-discover:typeSort', TYPE_TRENDING); + const [timeSort, setTimeSort] = usePersistedState('claim-list-discover:timeSort', TIME_WEEK); const [page, setPage] = useState(1); const toCapitalCase = string => string.charAt(0).toUpperCase() + string.slice(1); diff --git a/src/ui/util/use-persisted-state.js b/src/ui/util/use-persisted-state.js index c0fb2a1a9..adbb5f5df 100644 --- a/src/ui/util/use-persisted-state.js +++ b/src/ui/util/use-persisted-state.js @@ -9,6 +9,8 @@ export default function usePersistedState(key, firstTimeDefault) { defaultValue = true; } else if (item === 'false') { defaultValue = false; + } else { + defaultValue = item; } }