From 826cb079533b374b41400e9162c247d46f21cc21 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 7 Nov 2019 13:57:21 +0100 Subject: [PATCH] test fix --- client/src/components/molecules/Pagination.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/src/components/molecules/Pagination.tsx b/client/src/components/molecules/Pagination.tsx index 5d32e8a..f3e6260 100644 --- a/client/src/components/molecules/Pagination.tsx +++ b/client/src/components/molecules/Pagination.tsx @@ -21,12 +21,16 @@ export default class Pagination extends PureComponent< private mq = window.matchMedia && window.matchMedia('(min-width: 600px)') public componentDidMount() { - this.mq.addListener(this.viewportChange) - this.viewportChange(this.mq) + if (window && window.matchMedia) { + this.mq.addListener(this.viewportChange) + this.viewportChange(this.mq) + } } public componentWillUnmount() { - this.mq.removeListener(this.viewportChange) + if (window && window.matchMedia) { + this.mq.removeListener(this.viewportChange) + } } private viewportChange = (mq: { matches: boolean }) => {