From 9d792f5b8c8043cd98587bfbbcd89beaae14789a Mon Sep 17 00:00:00 2001 From: Uku Taht Date: Tue, 8 Feb 2022 13:57:39 -0600 Subject: [PATCH] Do not unobserve if there is no observer Fixes #639 --- assets/js/dashboard/components/lazy-loader.js | 2 +- assets/js/dashboard/pinned-header-hoc.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/dashboard/components/lazy-loader.js b/assets/js/dashboard/components/lazy-loader.js index 3824ef943..dd15c36eb 100644 --- a/assets/js/dashboard/components/lazy-loader.js +++ b/assets/js/dashboard/components/lazy-loader.js @@ -15,7 +15,7 @@ export default class extends React.Component { } componentWillUnmount() { - this.observer.unobserve(this.element); + this.observer && this.observer.unobserve(this.element); } render() { diff --git a/assets/js/dashboard/pinned-header-hoc.js b/assets/js/dashboard/pinned-header-hoc.js index 3150749db..d770213b7 100644 --- a/assets/js/dashboard/pinned-header-hoc.js +++ b/assets/js/dashboard/pinned-header-hoc.js @@ -24,7 +24,7 @@ export const withPinnedHeader = (WrappedComponent, selector) => { } componentWillUnmount() { - this.observer.unobserve(this.el); + this.observer && this.observer.unobserve(this.el); } render() {