Skip to content

Commit 4a07ebe

Browse files
Fix DynamicLayoutMap.remove (#674)
Co-authored-by: Kyle <kyle201817146@gmail.com>
1 parent 68b782a commit 4a07ebe

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutMap.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,18 @@ package struct DynamicLayoutMap {
6060
let index = map.partitionPoint { (id, value) in
6161
DynamicContainerID(uniqueId: uniqueId, viewIndex: 0) <= id
6262
}
63-
var endIndex = index
6463
guard index != map.count else {
6564
return
6665
}
67-
while endIndex != map.count {
68-
let indexUniqueId = map[index].id.uniqueId
69-
guard indexUniqueId == uniqueId else {
66+
var currentIndex = index
67+
repeat {
68+
let currentUniqueId = map[currentIndex].id.uniqueId
69+
guard currentUniqueId == uniqueId else {
7070
break
7171
}
72-
endIndex &+= 1
73-
}
74-
map.removeSubrange(index ..< endIndex)
72+
currentIndex &+= 1
73+
} while currentIndex != map.count
74+
map.removeSubrange(index ..< currentIndex)
7575
sortedSeed = .zero
7676
}
7777

0 commit comments

Comments
 (0)