Repository navigation
fix(utilities): stop Collapsible leaking its test waiter on a fast toggle - #621
Merged
Merged
Conversation
…ggle Closing a Collapsible before the open's requestAnimationFrame ran could leave the `frontile:collapsible` waiter pending: opacity went 0 -> 0, so no transitionend fired, and onTransitionEnd is the only place a close ends the waiter. The stale open frame could also still set opacity 1 on a panel that had just been closed. - Track the frames expand/contract schedule and cancel them on the next toggle and on teardown. - After applying the final styles, end the waiter immediately when getAnimations() shows no height/opacity transition running, and fall back to the same check in onTransitionEnd. Adds deterministic tests that stub requestAnimationFrame to reproduce both cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Deploy Preview for frontile-next ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Problem
does not leak a test waiter when toggled twice before the transition finishesfailed once in CI (run 38483680687, on #620) after ~3s with thefrontile:collapsiblewaiter still pending.If a Collapsible is closed before the open's
requestAnimationFramecallback has made it visible, the close's final frame setsopacity: 0on an element whose opacity is already0. No transition runs, so notransitionendfires — andonTransitionEndis the only place a close ends the waiter. The same race also let the stale open frame setopacity: 1on a panel that had just been closed.Fix
expand/contracttrack the frames they schedule and cancel the other direction's pending frames (and all of them on teardown).endWaiterUnlessTransitioningcheckselement.getAnimations()and ends the waiter immediately when no height/opacity transition is running.onTransitionEndfalls back to the same check, so a close where only height animates still settles once it finishes.Tests
Two new tests stub
requestAnimationFrame/cancelAnimationFramewith a manual queue so the race is deterministic. Both failed before the fix — the leak one with the same ~3s timeout signature as CI.frontilelint:types,lint:hbs: clean for the touched files🤖 Generated with Claude Code