Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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.currentState }
)
}

Expand Down
6 changes: 6 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,15 @@
XCTAssertNil(weakStore)
}

@MainActor
func testPublisherAsyncSequence() async {
let store = Store<Void, Void>(initialState: ()) {}
_ = await store.publisher.values.first { @Sendable _ in true }

Check failure on line 1181 in Tests/ComposableArchitectureTests/StoreTests.swift

View workflow job for this annotation

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

'values' is only available in iOS 15.0 or newer
}

@MainActor
func testSharedMutation() async {
XCTTODO(

Check warning on line 1186 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 1186 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