Skip to content

Commit

Permalink
Revert "Fix perception warnings (pointfreeco#2849)"
Browse files Browse the repository at this point in the history
This reverts commit 591f1a4.
  • Loading branch information
IanHoar committed Feb 29, 2024
1 parent 2c43dbf commit e1de6fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions Sources/ComposableArchitecture/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,7 @@ public final class Store<State, Action> {
/// it conforms to ``ObservableState``.
/// - Returns: The return value, if any, of the `body` closure.
public func withState<R>(_ body: (_ state: State) -> R) -> R {
#if canImport(Perception)
_withoutPerceptionChecking { body(self.currentState) }
#else
body(self.currentState)
#endif
body(self.currentState)
}

/// Sends an action to the store.
Expand Down
4 changes: 2 additions & 2 deletions Sources/ComposableArchitecture/ViewStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ public final class ViewStore<ViewState, ViewAction>: ObservableObject {
action: fromViewAction,
isInvalid: nil
)
self._state = CurrentValueRelay(self.store.withState { $0 })
self._state = CurrentValueRelay(self.store.currentState)
self.viewCancellable = self.store.rootStore.didSet
.compactMap { [weak self] in self?.store.withState { $0 } }
.compactMap { [weak self] in self?.store.currentState }
.removeDuplicates(by: isDuplicate)
.dropFirst()
.sink { [weak self] in
Expand Down

0 comments on commit e1de6fc

Please sign in to comment.