Do not unobserve if there is no observer

Fixes #639
This commit is contained in:
Uku Taht 2022-02-08 13:57:39 -06:00
parent 408d95fe09
commit 9d792f5b8c
2 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ export default class extends React.Component {
}
componentWillUnmount() {
this.observer.unobserve(this.element);
this.observer && this.observer.unobserve(this.element);
}
render() {

View File

@ -24,7 +24,7 @@ export const withPinnedHeader = (WrappedComponent, selector) => {
}
componentWillUnmount() {
this.observer.unobserve(this.el);
this.observer && this.observer.unobserve(this.el);
}
render() {