Files
bsky-social-app/modules/bottom-sheet
Claude 421c4abd02 Fix sheet getting set to previous height on rapid content changes
The KVO callback was calling updateLayout(), which has two problems for
content-driven updates:

1. The prevLayoutDetentIdentifier guard can block updates. When
   updateDetents triggers animateChanges, the delegate callback
   sheetPresentationControllerDidChangeSelectedDetentIdentifier fires
   and updates selectedDetentIdentifier to the system-assigned custom
   detent identifier. On the next KVO callback, prevLayoutDetentIdentifier
   (.medium) no longer matches selectedDetentIdentifier, so the update
   is silently dropped.

2. Re-reading frame.size.height from the view hierarchy instead of using
   the observed bounds can return a stale value during rapid layout passes.

Fix: have the KVO callback call updateDetents directly with the observed
height, bypassing both the guard and the frame re-read. The guard in
updateLayout() is preserved for the manual/fallback code path.

https://claude.ai/code/session_01Rp7ef1h3fKh6fhStcjqLJ5
2026-03-06 23:38:10 +02:00
..