Fix dev tools event listener leak on Turbo navigation - #119
Draft
marcoroth wants to merge 1 commit into
Draft
Conversation
marcoroth
marked this pull request as draft
August 8, 2026 04:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes the browser performance degradation reported when
debug_modeis enabled on an application using Turbo navigation. Every Turbo visit added a new batch ofdocumentevent listeners, and none of them were ever removed.initializeDevToolswas registered on three separate Turbo events, so a single navigation invoked it three times, and each invocation constructed a freshHerbOverlay:Nothing tore the old overlays down.
ReActionViewDevTools#destroyonly removed the.herb-floating-menuelement from the DOM, which strips the UI while leaving every handler attached and every overlay instance live and still responding to Turbo events.Follow-up once the Herb fix ships
marcoroth/herb#2081 addresses the remaining leaks inside
@herb-tools/dev-toolsitself. Thedocumentclick listener thatsetupMenuToggleadds on every navigation, and the absence of anydestroyonHerbOverlayandErrorOverlay.That fix does not reach users through a gem upgrade.
rollup.config.jssetsexternal: []alongsidenodeResolve(), so@herb-tools/dev-toolsand@herb-tools/clientare compiled directly intoapp/assets/javascripts/reactionview-dev-tools.{umd,esm}.js, and those vendored bundles are the only JavaScript the gem serves.Picking up the Herb fix therefore needs, in order:
@herb-tools/dev-toolsand@herb-tools/clientoff^0.10.3ReActionViewDevTools#destroyto the newHerbOverlay#destroyinstead of hand-removing.herb-floating-menu, which fixes the publicinitReActionViewDevToolsand manual teardown paths that this pull request deliberately leaves alone.Depends on marcoroth/herb#2081
Resolves #108