Revert "Fix uploads page cleared/reloaded on each navigation" (#1771)

This reverts commit 1dccc1ac64.

Closes 1770
Re-opens "1515 uploads page cleared/reloaded on each navigation"

1515 is just a minor annoyance, while the current issue is a non-functional page, so reverting for now and revisit later.
This commit is contained in:
infinite-persistence 2022-06-29 20:04:33 +08:00 committed by GitHub
parent 3f44b80603
commit 4b1bf22154
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,8 +18,6 @@ const FILTER_ALL = 'stream,repost';
const FILTER_UPLOADS = 'stream';
const FILTER_REPOSTS = 'repost';
let session;
type Props = {
uploadCount: number,
claimsByUri: { [string]: any },
@ -29,7 +27,7 @@ type Props = {
fetching: boolean,
urls: Array<string>,
urlTotal: number,
history: { action: string, replace: (string) => void, push: (string) => void },
history: { replace: (string) => void, push: (string) => void },
page: number,
pageSize: number,
doFetchViewCount: (claimIdCsv: string) => void,
@ -45,16 +43,11 @@ function FileListPublished(props: Props) {
fetching,
urls,
urlTotal,
history,
page,
pageSize,
doFetchViewCount,
} = props;
const { action: historyAction } = history;
const refreshedPage = session === undefined;
const navigated = historyAction === 'POP' && !refreshedPage;
const [filterBy, setFilterBy] = React.useState(FILTER_ALL);
const params = {};
@ -63,20 +56,16 @@ function FileListPublished(props: Props) {
const paramsString = JSON.stringify(params);
React.useEffect(() => {
session = Date.now();
}, []);
useEffect(() => {
checkPendingPublishes();
}, [checkPendingPublishes]);
useEffect(() => {
if (paramsString && fetchClaimListMine && !navigated) {
if (paramsString && fetchClaimListMine) {
const params = JSON.parse(paramsString);
fetchClaimListMine(params.page, params.page_size, true, filterBy.split(','));
}
}, [uploadCount, paramsString, filterBy, fetchClaimListMine, navigated]);
}, [uploadCount, paramsString, filterBy, fetchClaimListMine]);
useFetchViewCount(!fetching, urls, claimsByUri, doFetchViewCount);