try only updating page size on mount

ref #333
This commit is contained in:
Collin M. Barrett 2018-08-12 15:43:12 -05:00
parent 0ca4f707b6
commit 39446e1d3e

View file

@ -43,7 +43,6 @@ export class Home extends React.Component<RouteComponentProps<{}>, IHomeState> {
componentDidMount() {
this.updatePageSize();
window.addEventListener("resize", this.updatePageSize);
fetch("https://filterlists.com/api/v1/lists")
.then(response => response.json() as Promise<IListDto[]>)
.then(data => {
@ -62,10 +61,6 @@ export class Home extends React.Component<RouteComponentProps<{}>, IHomeState> {
});
}
componentWillUnmount() {
window.removeEventListener("resize", this.updatePageSize);
}
updatePageSize() {
this.setState({
pageSize: Math.floor((window.innerHeight - 361) / 52)