Skip to content

fix(hint): remove resize listener in disableHintAutoRefresh()#2163

Open
shaked-shlomo wants to merge 1 commit into
usablica:masterfrom
shaked-shlomo:fix/disable-hint-autorefresh-resize-listener
Open

fix(hint): remove resize listener in disableHintAutoRefresh()#2163
shaked-shlomo wants to merge 1 commit into
usablica:masterfrom
shaked-shlomo:fix/disable-hint-autorefresh-resize-listener

Conversation

@shaked-shlomo

Copy link
Copy Markdown

Problem

disableHintAutoRefresh() is supposed to remove the scroll and resize listeners that enableHintAutoRefresh() attaches. But the resize line uses DOMEvent.on instead of DOMEvent.off:

disableHintAutoRefresh(): this {
  if (this._hintsAutoRefreshFunction) {
    DOMEvent.off(window, "scroll", this._hintsAutoRefreshFunction, true);
    DOMEvent.on(window, "resize", this._hintsAutoRefreshFunction, true);  // <-- re-adds instead of removing

    this._hintsAutoRefreshFunction = undefined;
  }
  return this;
}

So after calling disableHintAutoRefresh():

  • the scroll listener is correctly removed, but
  • the resize listener is re-attached (a duplicate is added), and then this._hintsAutoRefreshFunction is set to undefined — leaking the listener so it can never be removed.

This mirrors enableHintAutoRefresh() just above, which correctly uses DOMEvent.on for both events.

Fix

Use DOMEvent.off for the resize event so both listeners are removed, matching the method's intent and its name.

🤖 Generated with Claude Code

disableHintAutoRefresh() called DOMEvent.on() for the 'resize' event
instead of DOMEvent.off(), so disabling auto-refresh removed the 'scroll'
listener but re-attached the 'resize' listener. The handler kept firing
after being disabled and the reference was leaked.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Pean Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant