Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sources/ComposableArchitecture/Store.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Combine
import CombineSchedulers
import Foundation
import SwiftUI

Expand Down Expand Up @@ -375,7 +376,7 @@ public final class Store<State, Action>: _Store {
public var publisher: StorePublisher<State> {
StorePublisher(
store: self,
upstream: self.core.didSet.map { self.currentState }
upstream: self.core.didSet.receive(on: UIScheduler.shared).map { self.withState(\.self) }
)
}

Expand Down
8 changes: 8 additions & 0 deletions Tests/ComposableArchitectureTests/StoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@
childTask.cancel()
await mainQueue.advance(by: 1)
try await Task.sleep(nanoseconds: 100_000_000)
XCTTODO(

Check warning on line 849 in Tests/ComposableArchitectureTests/StoreTests.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (16) (test, MACOS, 16.4)

'XCTTODO' is deprecated: This is a test that currently fails but should not in the future.

Check warning on line 849 in Tests/ComposableArchitectureTests/StoreTests.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (16) (test, IOS, 16.4)

'XCTTODO' is deprecated: This is a test that currently fails but should not in the future.
"""
This fails because cancelling a child task will cancel all parent effects too.
"""
Expand Down Expand Up @@ -1175,9 +1175,17 @@
XCTAssertNil(weakStore)
}

@MainActor
func testPublisherAsyncSequence() async {
if #available(iOS 15, macOS 12, tvOS 15, watchOS 8, *) {
let store = Store<Void, Void>(initialState: ()) {}
_ = await store.publisher.values.first { @Sendable _ in true }
}
}

@MainActor
func testSharedMutation() async {
XCTTODO(

Check warning on line 1188 in Tests/ComposableArchitectureTests/StoreTests.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (16) (test, MACOS, 16.4)

'XCTTODO' is deprecated: This is a test that currently fails but should not in the future.

Check warning on line 1188 in Tests/ComposableArchitectureTests/StoreTests.swift

View workflow job for this annotation

GitHub Actions / xcodebuild (16) (test, IOS, 16.4)

'XCTTODO' is deprecated: This is a test that currently fails but should not in the future.
"""
Ideally this will pass in 2.0 but it's a breaking change for test stores to not eagerly \
process all received actions.
Expand Down
Loading