Closed zerosrat closed 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
util | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 29, 2023 8:36am |
It's strange to provide empty as target. But this code seems fine.
It's strange to provide empty as target. But this code seems fine.
The origin issuse is from stickyScrollBar of rc-table. The code is as follows:
React.useEffect(function () {
var onMouseUpListener = addEventListener(document.body, 'mouseup', onMouseUp, false);
}, [])
When invoking addEventListener in useEffect, document.body
is null. Add null check can avoid the error log, but it still cannot add listener as expected.
@zombieJ
When target is nullish, it will throw
TypeError: Cannot read properties of null (reading 'addEventListener')
. So I add the optional chaining to avoid the error.@zombieJ