From c7241d0509fa7e3d48f974f95a2cced21a5ddab6 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 2 Nov 2021 19:46:43 -0500 Subject: [PATCH] useResize: fix destructor --- pkg/interface/src/logic/lib/useResize.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/interface/src/logic/lib/useResize.ts b/pkg/interface/src/logic/lib/useResize.ts index 4f159883c..4daf40b1d 100644 --- a/pkg/interface/src/logic/lib/useResize.ts +++ b/pkg/interface/src/logic/lib/useResize.ts @@ -15,11 +15,12 @@ export function useResize( callback(entry, observer); } } + let el = ref.current; const resizeObs = new ResizeObserver(observer); - resizeObs.observe(ref.current, { box: 'border-box' }); + resizeObs.observe(el, { box: 'border-box' }); return () => { - resizeObs.unobserve(ref.current); + resizeObs.unobserve(el); }; }, [callback]);