From 634e28e95ec65fe3e9984dad6cc9832f96f3ba5c Mon Sep 17 00:00:00 2001 From: Cristian Boarna Date: Mon, 7 Nov 2022 13:56:33 +0200 Subject: [PATCH] fix(intersection obs): handled edge case where component not visible --- src/components/PlaceholderWithoutTracking.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PlaceholderWithoutTracking.jsx b/src/components/PlaceholderWithoutTracking.jsx index 766cdd1..9ad4a20 100644 --- a/src/components/PlaceholderWithoutTracking.jsx +++ b/src/components/PlaceholderWithoutTracking.jsx @@ -51,7 +51,7 @@ class PlaceholderWithoutTracking extends React.Component { } componentWillUnmount() { - if (this.observer) { + if (this.observer && this.placeholder) { this.observer.unobserve(this.placeholder); } }