Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii committed Oct 21, 2024
1 parent ea8f1e5 commit 05c485b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/Verge/Store/StoreDriverType+Accumulator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extension StoreDriverType {
*/
public func accumulate<T>(
queue: MainActorTargetQueue = .mainIsolated(),
@AccumulationSinkComponentBuilder<Scope> _ buildSubscription: @escaping @MainActor (consuming AccumulationBuilder<Scope>) -> _AccumulationSinkGroup<Scope, T>
@AccumulationSinkComponentBuilder<Scope> _ buildSubscription: @escaping @MainActor (_ builder: borrowing AccumulationBuilder<Scope>, _ state: borrowing Self.Scope) -> _AccumulationSinkGroup<Scope, T>
) -> StoreStateSubscription {

var previousBox: ReferenceEdge<_AccumulationSinkGroup<Scope, T>?> = .init(wrappedValue: nil)
Expand All @@ -19,7 +19,7 @@ extension StoreDriverType {
previousBox.wrappedValue
})

var group = buildSubscription(consume builder)
var group = buildSubscription(builder, state.primitive)

// sets the latest value
group = group.receive(source: state.primitiveBox)
Expand All @@ -46,7 +46,7 @@ extension StoreDriverType {
@_disfavoredOverload
public func accumulate<T>(
queue: some TargetQueueType,
@AccumulationSinkComponentBuilder<Scope> _ buildSubscription: @escaping @Sendable (consuming AccumulationBuilder<Scope>) -> _AccumulationSinkGroup<Scope, T>
@AccumulationSinkComponentBuilder<Scope> _ buildSubscription: @escaping @Sendable (_ builder: borrowing AccumulationBuilder<Scope>, _ state: borrowing Self.Scope) -> _AccumulationSinkGroup<Scope, T>
) -> StoreStateSubscription {

let previousBox: UnsafeSendableBox<ReferenceEdge<_AccumulationSinkGroup<Scope, T>?>> = .init(value: .init(wrappedValue: nil))
Expand All @@ -65,7 +65,7 @@ extension StoreDriverType {
previousBox.value.wrappedValue
})

var group = buildSubscription(consume builder)
var group = buildSubscription(builder, state.primitive)

// sets the latest value
group = group.receive(source: state.primitiveBox)
Expand Down

0 comments on commit 05c485b

Please sign in to comment.