Skip to content

Commit 27db3df

Browse files
authored
UIKit: Skip UIBindable perception checks (#3744)
1 parent 4c47829 commit 27db3df

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

ComposableArchitecture.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/ComposableArchitecture/Observation/NavigationStack+Observation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ extension Store {
484484
@_spi(Internals)
485485
public var _isInPerceptionTracking: Bool {
486486
#if DEBUG && !os(visionOS)
487-
return _PerceptionLocals.isInPerceptionTracking
487+
return _PerceptionLocals.isInPerceptionTracking || _PerceptionLocals.skipPerceptionChecking
488488
#else
489489
return false
490490
#endif

Sources/ComposableArchitecture/Observation/Store+Observation.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,18 @@ extension UIBindable {
403403
column: UInt = #column
404404
) -> UIBinding<Store<ChildState, ChildAction>?>
405405
where Value == Store<State, Action> {
406-
self[
407-
id: wrappedValue.currentState[keyPath: state].flatMap(_identifiableID),
406+
#if DEBUG && canImport(SwiftUI)
407+
let id = _PerceptionLocals.$skipPerceptionChecking.withValue(true) {
408+
wrappedValue.currentState[keyPath: state].flatMap(_identifiableID)
409+
}
410+
#else
411+
let id = wrappedValue.currentState[keyPath: state].flatMap(_identifiableID)
412+
#endif
413+
return self[
414+
id: id,
408415
state: state,
409416
action: action,
410-
isInViewBody: _isInPerceptionTracking,
417+
isInViewBody: true,
411418
fileID: _HashableStaticString(rawValue: fileID),
412419
filePath: _HashableStaticString(rawValue: filePath),
413420
line: line,

0 commit comments

Comments
 (0)