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
|
||||
currentPage={currentPage}
|
||||
itemsPerPage={itemsPerPage}
|
||||
totalWords={stats.hasOwnProperty('numberOfWords')
|
||||
? stats.numberOfWords.find(group => group.name === 'Total').value : null}
|
||||
stats={stats}
|
||||
setPage={ setPage } />
|
||||
</RightColumn>
|
||||
|
||||
|
|
|
@ -5,12 +5,15 @@ export const Pagination = (props) => {
|
|||
PropTypes.checkPropTypes({
|
||||
currentPage: PropTypes.number.isRequired,
|
||||
itemsPerPage: PropTypes.number.isRequired,
|
||||
totalWords: PropTypes.number,
|
||||
stats: PropTypes.number,
|
||||
setPage: PropTypes.func.isRequired,
|
||||
}, 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) {
|
||||
return <div className="loader"></div>;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue