don't persist by default for FileList

This commit is contained in:
Sean Yesmunt 2019-06-11 14:38:08 -04:00
parent 510307de01
commit 6e59e5b1b3
3 changed files with 8 additions and 12 deletions

View file

@ -24,7 +24,7 @@ type Props = {
export default function FileList(props: Props) { export default function FileList(props: Props) {
const { uris, header, headerAltControls, injectedItem, loading, persistedStorageKey, noHeader, slim, empty } = props; const { uris, header, headerAltControls, injectedItem, loading, persistedStorageKey, noHeader, slim, empty } = props;
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey || 'file-list-global-sort', SORT_NEW); const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
const sortedUris = uris && currentSort === SORT_OLD ? uris.reverse() : uris; const sortedUris = uris && currentSort === SORT_OLD ? uris.reverse() : uris;
const hasUris = uris && !!uris.length; const hasUris = uris && !!uris.length;

View file

@ -1,10 +1,10 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { selectIsFetchingClaimListMine, selectMyClaimsWithoutChannels } from 'lbry-redux'; import { selectIsFetchingClaimListMine, selectMyClaimUrisWithoutChannels } from 'lbry-redux';
import { doCheckPendingPublishes } from 'redux/actions/publish'; import { doCheckPendingPublishes } from 'redux/actions/publish';
import FileListPublished from './view'; import FileListPublished from './view';
const select = state => ({ const select = state => ({
claims: selectMyClaimsWithoutChannels(state), uris: selectMyClaimUrisWithoutChannels(state),
fetching: selectIsFetchingClaimListMine(state), fetching: selectIsFetchingClaimListMine(state),
}); });

View file

@ -5,27 +5,23 @@ import FileList from 'component/fileList';
import Page from 'component/page'; import Page from 'component/page';
type Props = { type Props = {
claims: Array<StreamClaim>, uris: Array<string>,
checkPendingPublishes: () => void, checkPendingPublishes: () => void,
fetching: boolean, fetching: boolean,
}; };
function FileListPublished(props: Props) { function FileListPublished(props: Props) {
const { checkPendingPublishes, fetching, claims } = props; const { checkPendingPublishes, fetching, uris } = props;
useEffect(() => { useEffect(() => {
checkPendingPublishes(); checkPendingPublishes();
}, [checkPendingPublishes]); }, [checkPendingPublishes]);
return ( return (
<Page notContained loading={fetching}> <Page notContained>
{claims && claims.length ? ( {uris && uris.length ? (
<div className="card"> <div className="card">
<FileList <FileList loading={fetching} persistedStorageKey="file-list-published" uris={uris} />
persistedStorageKey="file-list-published"
// TODO: adjust selector to only return uris
uris={claims.map(info => `lbry://${info.name}#${info.claim_id}`)}
/>
</div> </div>
) : ( ) : (
<div className="main--empty"> <div className="main--empty">