off by 1 again
This commit is contained in:
parent
88e39ed14e
commit
53402c4759
4 changed files with 6 additions and 22 deletions
|
@ -6,7 +6,7 @@ import { withRouter } from 'react-router';
|
|||
const select = (state, props) => {
|
||||
const { search } = props.location;
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const page = Number(urlParams.get('page')) || 0;
|
||||
const page = Number(urlParams.get('page')) || 1;
|
||||
return {
|
||||
page,
|
||||
downloadedUris: makeSelectDownloadUrisForPage(page)(state),
|
||||
|
|
|
@ -14,7 +14,7 @@ type Props = {
|
|||
};
|
||||
|
||||
function FileListDownloaded(props: Props) {
|
||||
const { fetching, downloadedUris, downloadedUrisCount, history, page } = props;
|
||||
const { fetching, downloadedUris, downloadedUrisCount } = props;
|
||||
const hasDownloads = !!downloadedUris.length;
|
||||
return (
|
||||
// Removed the <Page> wapper to try combining this page with UserHistory
|
||||
|
@ -29,15 +29,7 @@ function FileListDownloaded(props: Props) {
|
|||
uris={downloadedUris}
|
||||
loading={fetching}
|
||||
/>
|
||||
<Paginate
|
||||
onPageChange={p => {
|
||||
if (page !== p) {
|
||||
history.replace(`#/$/published?page=${p}`);
|
||||
}
|
||||
}}
|
||||
totalPages={Math.floor(Number(downloadedUrisCount) / Number(PAGE_SIZE))}
|
||||
loading={fetching}
|
||||
/>
|
||||
<Paginate totalPages={Math.ceil(Number(downloadedUrisCount) / Number(PAGE_SIZE))} loading={fetching} />
|
||||
</div>
|
||||
) : (
|
||||
<div className="main--empty">
|
||||
|
|
|
@ -7,7 +7,7 @@ import { withRouter } from 'react-router';
|
|||
const select = (state, props) => {
|
||||
const { search } = props.location;
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const page = Number(urlParams.get('page')) || 0;
|
||||
const page = Number(urlParams.get('page')) || 1;
|
||||
return {
|
||||
page,
|
||||
uris: makeSelectMyStreamUrisForPage(page)(state),
|
||||
|
|
|
@ -16,7 +16,7 @@ type Props = {
|
|||
};
|
||||
|
||||
function FileListPublished(props: Props) {
|
||||
const { checkPendingPublishes, fetching, uris, uriTotal, history, page } = props;
|
||||
const { checkPendingPublishes, fetching, uris, uriTotal } = props;
|
||||
useEffect(() => {
|
||||
checkPendingPublishes();
|
||||
}, [checkPendingPublishes]);
|
||||
|
@ -33,15 +33,7 @@ function FileListPublished(props: Props) {
|
|||
defaultSort
|
||||
headerAltControls={<Button button="link" label={__('New Publish')} navigate="/$/publish" />}
|
||||
/>
|
||||
<Paginate
|
||||
onPageChange={p => {
|
||||
if (page !== p) {
|
||||
history.replace(`#/$/published?page=${p + 1}`);
|
||||
}
|
||||
}}
|
||||
totalPages={Math.floor(Number(uriTotal) / Number(PAGE_SIZE))}
|
||||
loading={fetching}
|
||||
/>
|
||||
<Paginate totalPages={Math.ceil(Number(uriTotal) / Number(PAGE_SIZE))} loading={fetching} />
|
||||
</div>
|
||||
) : (
|
||||
<div className="main--empty">
|
||||
|
|
Loading…
Add table
Reference in a new issue