From 71d2f5f3729577a5564969a6032e75b31a26e783 Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 29 Oct 2025 00:37:16 +0800 Subject: [PATCH 1/2] Fix FunctionalLocation recursive compare --- Sources/OpenSwiftUICore/Data/Binding/Location.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/OpenSwiftUICore/Data/Binding/Location.swift b/Sources/OpenSwiftUICore/Data/Binding/Location.swift index c204ef44d..b1a1c7fe7 100644 --- a/Sources/OpenSwiftUICore/Data/Binding/Location.swift +++ b/Sources/OpenSwiftUICore/Data/Binding/Location.swift @@ -363,7 +363,7 @@ package struct FunctionalLocation: Location { } package static func == (lhs: FunctionalLocation, rhs: FunctionalLocation) -> Bool { - compareValues(lhs, rhs) + compareValues(lhs.functions, rhs.functions) } } From 2534c62ccc22de61faf6a5a4cd8651cc02c0ba2b Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 29 Oct 2025 01:08:42 +0800 Subject: [PATCH 2/2] Add FunctionalLocation equal test Note: this test does not cover the fix. Only run all ui test case and then LabelsHiddenModifierUITests.toggleLabelsHidden will hit the recursive loop --- .../OpenSwiftUICoreTests/Data/Binding/LocationTests.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/OpenSwiftUICoreTests/Data/Binding/LocationTests.swift b/Tests/OpenSwiftUICoreTests/Data/Binding/LocationTests.swift index 3462477a5..a376691b8 100644 --- a/Tests/OpenSwiftUICoreTests/Data/Binding/LocationTests.swift +++ b/Tests/OpenSwiftUICoreTests/Data/Binding/LocationTests.swift @@ -136,5 +136,13 @@ struct LocationTests { location.set(2, transaction: .init()) #expect(location.wasRead == true) #expect(location.get() == 4) + + let location2 = FunctionalLocation { + value.count + } setValue: { newCount, _ in + value.count = newCount * newCount + } + #expect(location2 != location) + #expect(location == location) } }