Skip to content

Commit 717e810

Browse files
committed
Update allUnary logic
1 parent b744311 commit 717e810

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Sources/OpenSwiftUICore/Layout/Dynamic/DynamicContainer.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,15 @@ struct DynamicContainerInfo<Adapter>: StatefulRule, AsyncAttribute, ObservedAttr
374374
var precedingCount: Int32 = 0
375375
var allUnary = true
376376
for index in 0..<inusedCount {
377+
info.indexMap[info.items[index].uniqueId] = index
377378
let item = info.items[index]
378-
info.indexMap[item.uniqueId] = index
379379
item.precedingViewCount = precedingCount
380380
allUnary = allUnary && item.viewCount == 1
381-
info.allUnary = allUnary
382-
precedingCount &+= item.viewCount
381+
if index != inusedCount {
382+
precedingCount &+= item.viewCount
383+
}
383384
}
385+
info.allUnary = allUnary
384386
}
385387
precondition(info.indexMap.count == inusedCount, "DynamicLayoutItem identifiers must be unique.")
386388
if hasDepth {

0 commit comments

Comments
 (0)