fix(element): withhold paint until a pixel translate actually settles - #122
Draft
DouweBos wants to merge 1 commit into
Draft
fix(element): withhold paint until a pixel translate actually settles#122DouweBos wants to merge 1 commit into
DouweBos wants to merge 1 commit into
Conversation
The withheld-paint reveal was bounded to one extra layout pass, so a translate that folds into the position later still painted the node at its untransformed origin for a frame. Wait for isTranslateSettled, bounded by a pass count so an undetectable translate can't strand the node invisible.
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.
What
LightningViewElementwithholds paint until a node's first layout resolves, andisTranslateSettledextends that so a pixel translate isn't revealed at its pre-transform origin. The reveal was bounded to exactly one extra layout pass:hadLayout ||short-circuits the check, so the second layout reveals unconditionally. A translate that folds into the position later than that — deeper in the async flex tree — still paints the node at its base position for a frame.The reveal now waits for
isTranslateSettledto actually return true, bounded byMAX_UNSETTLED_LAYOUTSso a translate the heuristic can't detect (percentage translates, right/bottom anchoring) still can't strand the node invisible.Why
Found while tracking down a drawer in the Plex RN client that is laid out on screen and translated off: at mount it flashed open for a frame before the translate landed.
Tests
Two cases added to
LightningViewElement.spec.ts. Both fail onmainfor the right reason — the node reveals on the second layout pass while still unsettled:Full package suite green (307 tests),
tsc --noEmitandoxlintclean.Note on formatting
Left the touched files as-committed rather than running
oxfmt— the repo's committed formatting predates oxfmt 0.45, so--checkalready fails on 5 files insrc/element/onmain. Running it here would have added ~190 lines of unrelated churn. Worth a separate formatting pass.