Skip to content

OpenSwiftUI evaluates display list one extra time with AttributeGraph #871

@Kyle-Ye

Description

@Kyle-Ye

Summary

With the AttributeGraph backend, OpenSwiftUI reaches the correct final display-list state, but it appears to evaluate the same minimal view one extra time compared with SwiftUI.

This is reproducible on both macOS and iOS Simulator.

Minimal repro

Use the Example app with this content view:

struct ContentView: View {
    var body: some View {
        Color.red
            .frame(width: 50, height: 50)
    }
}

Compare the Example app in OpenSwiftUI mode against SwiftUI mode.

Expected behavior

OpenSwiftUI should avoid the extra initial display-list evaluation when SwiftUI can produce the correctly placed item directly.

Actual behavior

OpenSwiftUI + AttributeGraph first evaluates the red view at (-25, -25), then evaluates it again at the correct centered frame. SwiftUI + AttributeGraph evaluates directly to the centered frame.

OpenSwiftUI + AttributeGraph

View 0x000000013b00ec20 at Time(seconds: 0.0):
(display-list
  (item #:identity 1 #:version 2
    (frame (-25.0 -25.0; 50.0 50.0))
    (content-seed 5)
    (color #FF3B30FF)))
View 0x000000013b00ec20 at Time(seconds: 0.0709835000016028):
(display-list
  (item #:identity 1 #:version 6
    (frame (225.0 125.0; 50.0 50.0))
    (content-seed 5)
    (color #FF3B30FF)))

SwiftUI + AttributeGraph

View 0x0000000138085400 at Time(seconds: 0.0):
(display-list
  (item #:identity 1 #:version 20
    (frame (425.0 214.0; 50.0 50.0))
    (content-seed 41)
    (color #FF3B30FF)))

Notes

  • This is separate from the Compute backend placement issue: the final OpenSwiftUI + AttributeGraph state is visually correct.
  • The issue is the extra evaluation/update before reaching the final centered frame.
  • Current local repro was based on main at 0674dc5a.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: graphViewGraph, AttributeGraph, graph hosts, and graph internals.area: renderingDisplayList, render backends, renderer hosts, drawing, and effects.type: bugSomething is not working correctly.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions