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