Repository navigation
fix(desktop): give the tutorial illustration a fixed size so Lottie stops a constraints loop - #3418
Merged
Merged
Conversation
…tops a constraints loop
Collaborator
Author
|
Fresh review of a28c757 against #3405: clear, no blocking findings. Labelled Correctness
Release diff 0.1.21..0.1.23 (other candidates)
Nits (non-blocking, description only)
Checks
|
janicduplessis
marked this pull request as ready for review
October 10, 2026 23:00
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.
Description
Stim Desktop 0.1.23 crashed (EXC_BREAKPOINT, uncaught NSException) after the main thread blocked for over 2 s. The tutorial panel was open on a tutorial workspace page. The tutorial record's step times put the stalls in the Live View step and the crash in the Agent Actions step. AppKit raised from
-[NSWindow(NSDisplayCycle) _postWindowNeedsUpdateConstraints], called fromNSHostingView.updateConstraints. That is the exception AppKit throws when the window keeps asking for another Update Constraints pass within one display cycle, so some view's size kept depending on its own layout pass.The crashed build does not contain #3397. Of the Desktop changes since 0.1.21, the last build that ran without this crash, only #3383's tutorial illustration puts a
LottieViewwhose size follows the panel's layout into the main window; every otherLottieViewhas a fixed frame.TutorialIllustrationsized itsLottieViewwith.resizable()inside.aspectRatio(288:168, .fit), so the panel's layout decided its size: the panel's 296 pt content width gives a 172.67 pt height. Every otherLottieViewin the app has a fixed integral frame. Lottie 4.6.1'sSwiftUIMeasurementContainermakes that combination self-referential on macOS:.proposedstrategy (.resizable()),measureView()answers an unspecified proposal with its current bounds (L257-L305), and.aspectRatio(.fit)likely asks for that ideal size when it resolves the ratio. The view's ideal size is therefore its own last layout result.layout()callsinvalidateIntrinsicContentSize()wheneverbounds.sizediffers at all from the last measured bounds (L99-L108). That makes the hosting view request another constraints pass.airbnb/lottie-ios#2678 (open, unmerged) describes the iOS form of the same loop: repeated re-measurement from exact-equality bounds checks hangs layout. It proposes a 1 pt threshold.
Solution
Not reproduced: the crash's tutorial workspaces were already removed, and idle tests at the default frame and at the maintainer's 1920x968 frame showed no difference between old and new code. The fix rests on the mechanism above, the release diff, and the crash evidence. There is no pure decision to unit test.
Give the illustration a fixed
288 x 168frame, the artwork's own size, in place of the aspect-fit sizing. SwiftUI then proposes a constant size, the container never reports its own bounds as its ideal size, and its bounds stop changing with the panel's layout. The panel has 296 pt available, so the art is now 8 pt narrower than before and centered.Fixes #3405
Test plan
stim macosfromapps/desktopwith the tutorial seeded at step 1 in the dev build's own defaults: the panel opens and the illustration renders and animates at 288 x 168.scripts/format.sh --check,node scripts/check-ascii.mjs,swift build -c release -Xswiftc -warnings-as-errors,swift test -Xswiftc -warnings-as-errors.