Skip to content

Commit 7929210

Browse files
authored
chore: defensive program (#1295)
1 parent dbf360d commit 7929210

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/FixedHolder/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@ const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<any>>((pro
106106
e.preventDefault();
107107
}
108108
}
109-
scrollRef.current?.addEventListener('wheel', onWheel, { passive: false });
109+
110+
const scrollEle = scrollRef.current;
111+
scrollEle?.addEventListener('wheel', onWheel, { passive: false });
110112

111113
return () => {
112-
scrollRef.current?.removeEventListener('wheel', onWheel);
114+
scrollEle?.removeEventListener('wheel', onWheel);
113115
};
114116
}, []);
115117

0 commit comments

Comments
 (0)