fix: homepage sort persistance

This commit is contained in:
Sean Yesmunt 2019-06-30 23:30:42 -04:00
parent ff80158f15
commit 2ee1855484
2 changed files with 5 additions and 3 deletions

View file

@ -39,9 +39,9 @@ type Props = {
function ClaimListDiscover(props: Props) { function ClaimListDiscover(props: Props) {
const { doClaimSearch, uris, tags, loading, personal, injectedItem, meta, subscribedChannels } = props; const { doClaimSearch, uris, tags, loading, personal, injectedItem, meta, subscribedChannels } = props;
const [personalSort, setPersonalSort] = usePersistedState('file-list-trending:personalSort', SEARCH_SORT_YOU); const [personalSort, setPersonalSort] = usePersistedState('claim-list-discover:personalSort', SEARCH_SORT_YOU);
const [typeSort, setTypeSort] = usePersistedState('file-list-trending:typeSort', TYPE_TRENDING); const [typeSort, setTypeSort] = usePersistedState('claim-list-discover:typeSort', TYPE_TRENDING);
const [timeSort, setTimeSort] = usePersistedState('file-list-trending:timeSort', TIME_WEEK); const [timeSort, setTimeSort] = usePersistedState('claim-list-discover:timeSort', TIME_WEEK);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const toCapitalCase = string => string.charAt(0).toUpperCase() + string.slice(1); const toCapitalCase = string => string.charAt(0).toUpperCase() + string.slice(1);

View file

@ -9,6 +9,8 @@ export default function usePersistedState(key, firstTimeDefault) {
defaultValue = true; defaultValue = true;
} else if (item === 'false') { } else if (item === 'false') {
defaultValue = false; defaultValue = false;
} else {
defaultValue = item;
} }
} }