Change when totalWords is evaluated in Pagination
This commit is contained in:
parent
38c8f2dcd1
commit
7eb656d376
|
@ -113,8 +113,7 @@ export class MainDisplay extends Component {
|
||||||
<Pagination
|
<Pagination
|
||||||
currentPage={currentPage}
|
currentPage={currentPage}
|
||||||
itemsPerPage={itemsPerPage}
|
itemsPerPage={itemsPerPage}
|
||||||
totalWords={stats.hasOwnProperty('numberOfWords')
|
stats={stats}
|
||||||
? stats.numberOfWords.find(group => group.name === 'Total').value : null}
|
|
||||||
setPage={ setPage } />
|
setPage={ setPage } />
|
||||||
</RightColumn>
|
</RightColumn>
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,15 @@ export const Pagination = (props) => {
|
||||||
PropTypes.checkPropTypes({
|
PropTypes.checkPropTypes({
|
||||||
currentPage: PropTypes.number.isRequired,
|
currentPage: PropTypes.number.isRequired,
|
||||||
itemsPerPage: PropTypes.number.isRequired,
|
itemsPerPage: PropTypes.number.isRequired,
|
||||||
totalWords: PropTypes.number,
|
stats: PropTypes.number,
|
||||||
setPage: PropTypes.func.isRequired,
|
setPage: PropTypes.func.isRequired,
|
||||||
}, props, 'prop', 'Pagination');
|
}, props, 'prop', 'Pagination');
|
||||||
|
|
||||||
const { currentPage, itemsPerPage, totalWords, setPage } = props;
|
const { currentPage, itemsPerPage, stats, setPage } = props;
|
||||||
|
|
||||||
|
const totalWords = stats.hasOwnProperty('numberOfWords')
|
||||||
|
? stats.numberOfWords.find(group => group.name === 'Total').value : null;
|
||||||
|
|
||||||
if (totalWords === null) {
|
if (totalWords === null) {
|
||||||
return <div className="loader"></div>;
|
return <div className="loader"></div>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue