fix: clear pending timers before scheduling new ones to prevent leaks

This commit is contained in:
okxint 2026-03-22 20:01:58 +05:30
parent fec2dda234
commit ab1552bc5d
1 changed files with 2 additions and 0 deletions

View File

@ -29,6 +29,7 @@ export const useOpenLink = () => {
const unregister = mergeRegister(
editor.registerUpdateListener(() => {
clearTimeout(updateTimer)
updateTimer = setTimeout(() => {
const {
selectedLinkUrl,
@ -54,6 +55,7 @@ export const useOpenLink = () => {
editor.registerCommand(
CLICK_COMMAND,
(payload) => {
clearTimeout(clickTimer)
clickTimer = setTimeout(() => {
const {
selectedLinkUrl,