Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -421,28 +421,22 @@ open class NSHostingView<Content>: NSView, XcodeViewDebugDataProvider where Cont
// TODO
NSAnimationContext.runAnimationGroup { context in
context.allowsImplicitAnimation = false
isUpdating = true
// TODO
render(targetTimestamp: nil)
// TODO
isUpdating = false
// TODO
if needsDeferredUpdate {
if !viewGraph.updateRequiredMainThread {
if isLinkedOnOrAfter(.v3) {
if startAsyncRendering() {
needsDeferredUpdate = false
}
var iteration = 0
repeat {
needsDeferredUpdate = false
isUpdating = true
render(targetTimestamp: nil)
isUpdating = false
if needsDeferredUpdate,
!viewGraph.updateRequiredMainThread,
isLinkedOnOrAfter(.v3),
!viewGraph.mayDeferUpdate {
if startAsyncRendering() {
needsDeferredUpdate = false
}
}
}
if needsDeferredUpdate {
onNextMainRunLoop { [weak self] in
guard let self else { return }
setNeedsUpdate()
}
needsDeferredUpdate = false
}
iteration += 1
} while needsDeferredUpdate && iteration < 8

@augmentcode augmentcode Bot Jun 7, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If needsDeferredUpdate remains true after hitting the iteration < 8 cap, there’s no follow-up scheduling (e.g. another setNeedsUpdate()), so the view could drop an update and get stuck. Is it guaranteed that this condition can’t persist beyond the loop?

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

}
}

Expand Down Expand Up @@ -782,8 +776,12 @@ open class NSHostingView<Content>: NSView, XcodeViewDebugDataProvider where Cont
static func defaultViewGraphOutputs() -> ViewGraph.Outputs { .defaults }

func setNeedsUpdate() {
needsUpdateConstraints = true
needsLayout = true
if isUpdating {
needsDeferredUpdate = true
} else {
needsUpdateConstraints = true
needsLayout = true
}
}

// MARK: - Window Notification Handlers
Expand Down Expand Up @@ -954,10 +952,13 @@ extension NSHostingView: ViewRendererHost {

if adjustedDelay >= 0.25 {
setUpdateTimer(delay: adjustedDelay)
} else if isUpdating {
needsDeferredUpdate = true
} else {
} else if adjustedDelay == 0 || !isUpdating {
setNeedsUpdate()
} else {
onNextMainRunLoop { [weak self] in
guard let self else { return }
setNeedsUpdate()
}
}

// TODO: Notify delegate
Expand Down
Loading