From 91b77d1f52154d8d1d3cf1614082e98066e33a4a Mon Sep 17 00:00:00 2001 From: Darius Kucinskas Date: Fri, 5 Jun 2020 19:28:35 +0300 Subject: [PATCH] Fixes issue were because of debouncing updateInitialDimension is triggered after outerElement is already destroyed. (#170) Co-authored-by: DEVB\darius.kucinskas --- src/Sticky.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Sticky.jsx b/src/Sticky.jsx index e4d40a11..c224929c 100644 --- a/src/Sticky.jsx +++ b/src/Sticky.jsx @@ -132,6 +132,10 @@ class Sticky extends Component { updateInitialDimension (options) { options = options || {} + if (!this.outerElement || !this.innerElement) { + return; + } + var outerRect = this.outerElement.getBoundingClientRect(); var innerRect = this.innerElement.getBoundingClientRect();