From ffe50c98d6b82a774e12ded62b743cc39a9ce9cf Mon Sep 17 00:00:00 2001 From: Dark-Existed Date: Mon, 15 Dec 2025 16:21:57 +0800 Subject: [PATCH 1/2] Fix DynamicLayoutMap.remove --- Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutMap.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutMap.swift b/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutMap.swift index f89b4b380..126a220b6 100644 --- a/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutMap.swift +++ b/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutMap.swift @@ -65,7 +65,7 @@ package struct DynamicLayoutMap { return } while endIndex != map.count { - let indexUniqueId = map[index].id.uniqueId + let indexUniqueId = map[endIndex].id.uniqueId guard indexUniqueId == uniqueId else { break } From 29dedd2e2c627f8a05399a0b204e8ae22e554170 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sun, 21 Dec 2025 15:55:00 +0800 Subject: [PATCH 2/2] Fix DynamicLayoutMap.remove --- .../Layout/Dynamic/DynamicLayoutMap.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutMap.swift b/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutMap.swift index 126a220b6..a7fb7df9e 100644 --- a/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutMap.swift +++ b/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutMap.swift @@ -60,18 +60,18 @@ package struct DynamicLayoutMap { let index = map.partitionPoint { (id, value) in DynamicContainerID(uniqueId: uniqueId, viewIndex: 0) <= id } - var endIndex = index guard index != map.count else { return } - while endIndex != map.count { - let indexUniqueId = map[endIndex].id.uniqueId - guard indexUniqueId == uniqueId else { + var currentIndex = index + repeat { + let currentUniqueId = map[currentIndex].id.uniqueId + guard currentUniqueId == uniqueId else { break } - endIndex &+= 1 - } - map.removeSubrange(index ..< endIndex) + currentIndex &+= 1 + } while currentIndex != map.count + map.removeSubrange(index ..< currentIndex) sortedSeed = .zero }