Skip to content

Commit

Permalink
pipeline gets storage (#487)
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii authored Feb 15, 2025
1 parent 129e872 commit 5834b56
Show file tree
Hide file tree
Showing 6 changed files with 326 additions and 189 deletions.
10 changes: 6 additions & 4 deletions Sources/Verge/Derived/Derived.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ public class Derived<Value>: Store<Value, Never>, DerivedType, @unchecked Sendab
retainsUpstream: Any?
) where Pipeline.Input == UpstreamState, Value == Pipeline.Output {

nonisolated(unsafe) weak var indirectSelf: Derived<Value>?
let pipelineStorage: Pipeline.Storage = pipeline.makeStorage()

let s = subscribeUpstreamState { @Sendable value in
let update = pipeline.yieldContinuously(value)
nonisolated(unsafe)weak var indirectSelf: Derived<Value>?

let s = subscribeUpstreamState { value in
let update = pipeline.yieldContinuously(value, storage: pipelineStorage)
switch update {
case .noUpdates:
break
Expand All @@ -135,7 +137,7 @@ public class Derived<Value>: Store<Value, Never>, DerivedType, @unchecked Sendab
self._set = set
super.init(
name: name,
initialState: pipeline.yield(initialUpstreamState),
initialState: pipeline.yield(initialUpstreamState, storage: pipelineStorage),
logger: nil,
sanitizer: nil
)
Expand Down
Loading

0 comments on commit 5834b56

Please sign in to comment.