try only updating page size on mount

ref #333
This commit is contained in:
Collin Barrett 2018-08-12 15:43:12 -05:00
parent 4e83f9c779
commit c18d6e2c2e

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)