Repository navigation
fix: prevent sidebar resize listener accumulation - #153
Closed
dajiaohuang wants to merge 1 commit into
Closed
dajiaohuang wants to merge 1 commit into
dajiaohuang wants to merge 1 commit into
Conversation
|
@dajiaohuang is attempting to deploy a commit to the Bootlab BV Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Thank you! v4.0.0 rewrote sidebar.js, and the transitionend listener now removes itself after it fires once. That fixes the problem, so closing this. |
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.
Summary
Register the sidebar's transition listener once during initialization instead of creating another listener on every toggle. Filter bubbling transition events to the sidebar's own
margin-lefttransition before dispatching the resize event. This prevents the resize work from growing on every open/close cycle and avoids dispatches for unrelated child/property transitions.The checked-in demo bundle and source map are regenerated from the source change.
Evidence
A synthetic DOM harness loaded the actual
src/js/modules/sidebar.jswith mocked sidebar/toggle elements. Before the fix, two toggles followed by one sidebarmargin-lefttransition each produced 3 resize events; after, they produced 2. The harness also injected unrelatedleft/rightand descendantcolortransition events; those produced no extra resize events.Validation
npm run build— passed; refreshedstatic/js/app.jsand its source map.node --check static/js/app.js— passed.git diff --check— passed..eslintrcuses unknown environment keyes7with installed ESLint 8.57.1. No config workaround was applied.No application server, hosted service, production tenant/data, real account, or external API was used. No screenshot was captured; validation is the synthetic event-level reproduction.