Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Example/HostingExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ class ViewController: NSViewController {

struct ContentView: View {
var body: some View {
ToggleExample()
DynamicLayoutViewExample()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// DynamicLayoutViewUITests.swift
// OpenSwiftUIUITests

import SnapshotTesting
import Testing

@MainActor
@Suite(.snapshots(record: .never, diffTool: diffTool))
struct DynamicLayoutViewUITests {
@Test
func dynamicLayout() {
struct ContentView: View {
@State var show = false
var body: some View {
VStack {
Color.red
.task { show = true }
if show {
Color.blue
}
}
}
}
openSwiftUIAssertSnapshot(of: ContentView())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// DynamicLayoutViewExample.swift
// SharedExample

#if OPENSWIFTUI
import OpenSwiftUI
#else
import SwiftUI
#endif

struct DynamicLayoutViewExample: View {
@State var show = false
var body: some View {
VStack {
Color.red
.task { show = true }
if show {
Color.blue
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ struct DynamicContainerInfo<Adapter>: StatefulRule, AsyncAttribute, ObservedAttr
needsPhaseUpdate = false
}
let (changed, hasDepth) = updateItems(disableTransitions: disableTransitions)
if !changed {
if changed {
needsUpdate = true
} else {
for (index, item) in info.items.enumerated().reversed() {
guard let phase = item.phase else {
continue
Expand Down
Loading