Skip to content

fix: prevent composer layout feedback loop by deferring state updates#23672

Merged
siddseethepalli merged 1 commit into
mainfrom
sidd/composer-layout-feedback-loop
Apr 6, 2026
Merged

fix: prevent composer layout feedback loop by deferring state updates#23672
siddseethepalli merged 1 commit into
mainfrom
sidd/composer-layout-feedback-loop

Conversation

@siddseethepalli

Copy link
Copy Markdown
Contributor

Summary

  • Remove measuredHeight binding — IntrinsicScrollView.contentHeight now drives sizing directly, avoiding a SwiftUI state round-trip during layout
  • Defer focus-binding and first-responder mutations to the next run-loop tick via scheduleFocusBindingUpdate / scheduleFirstResponderUpdate, preventing writes to @Binding during updateNSView
  • Both deferred paths use a pending-value guard to coalesce rapid changes and skip stale updates

Remove the measuredHeight binding that bounced layout state through
SwiftUI and defer focus-binding and first-responder mutations to the
next run-loop tick via DispatchQueue.main.async.  Both schedulers use a
pending-value guard to coalesce rapid changes and avoid stale updates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant