修复合并对话消息导致的右键菜单报错问题

This commit is contained in:
CrescentLeaf
2026-01-09 22:46:14 +08:00
parent 922791a0f5
commit 687088a284
4 changed files with 11 additions and 6 deletions

View File

@@ -1,7 +1,9 @@
import * as React from 'react'
export default function useEventListener<T extends HTMLElement | undefined | null>(ref: React.MutableRefObject<T>, eventName: string, callback: (event: Event) => void) {
// console.error(ref, eventName, callback)
React.useEffect(() => {
// console.warn(ref, eventName, callback)
ref.current!.addEventListener(eventName, callback)
return () => ref.current?.removeEventListener(eventName, callback)
}, [ref, eventName, callback])