fix: Affix target add listeners protect (#45291) (#45314)

* Fix: Affix target add listeners protect (#45291)

* Update components/affix/index.tsx

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: lijianan <574980606@qq.com>

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: lijianan <574980606@qq.com>
Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
mingming-ma 2023-10-13 22:49:23 -04:00 committed by GitHub
parent bce43064ff
commit 73c0cd7b49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -197,6 +197,9 @@ const InternalAffix = React.forwardRef<AffixRef, InternalAffixProps>((props, ref
const addListeners = () => {
const listenerTarget = targetFunc?.();
if (!listenerTarget) {
return;
}
TRIGGER_EVENTS.forEach((eventName) => {
if (prevListener.current) {
prevTarget.current?.removeEventListener(eventName, prevListener.current);