test: pin controller notify count for layout cycle (#122)#129
Merged
Conversation
Issue #122 questioned whether the post-frame setRenderedSizes notify could be elided. Investigation shows it is structurally required: the notify triggers the build-path switch from the layout widget (with non-interactive placeholder dividers) to the flex widget (with interactive dividers), and notifyListeners cannot legally run during performLayout. These tests pin the resulting notification cadence — one notify on initial mount, two per hide — so a future refactor cannot silently introduce a third redundant cycle or remove the load-bearing one. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
Closes #122.
The issue asked whether the post-frame
setRenderedSizesnotify could be elided to avoid a layout retrigger. Investigation shows the notify is structurally required, not wasted:_buildForPhasefromResizableLayout(placeholder, non-interactive dividers) toFlex(interactive dividers withonResizeUpdate). Without it, dividers can't be dragged after the first layout.notifyListeners()triggersmarkNeedsBuild, which is illegal duringperformLayout, so the post-frame defer is required.controller.pixelsis public API — user listeners legitimately expect to be notified when rendered pixels populate._needsLayout = falseis set before the notify, so the resulting rebuild takes the Flex path and never re-enters layout. The "re-trigger" risk is already short-circuited.Empirical measurement: 1 notify on initial mount, 2 notifies per
hide()(one fromsetHidden, one from the post-framesetRenderedSizes). Both convey real state changes.No
lib/changes. Adds two regression tests under a newnotify countgroup that pin the cadence — a future refactor that accidentally adds a third notify or removes the load-bearing one will fail.Test plan
initial mount notifies exactly oncehide produces exactly two notifies🤖 Generated with Claude Code