@@ -100,8 +100,8 @@ internal struct StoreContext {
100100 }
101101
102102 @usableFromInline
103- func watch< Node: Atom > ( _ atom: Node , in transaction : Transaction ) -> Node . Produced {
104- guard !transaction . isTerminated else {
103+ func watch< Node: Atom > ( _ atom: Node , in transactionState : TransactionState ) -> Node . Produced {
104+ guard !transactionState . isTerminated else {
105105 return read ( atom)
106106 }
107107
@@ -112,8 +112,8 @@ internal struct StoreContext {
112112 let value = cache? . value ?? initialize ( of: atom, for: key, override: override)
113113
114114 // Add an `Edge` from the upstream to downstream.
115- store. graph. dependencies [ transaction . key, default: [ ] ] . insert ( key)
116- store. graph. children [ key, default: [ ] ] . insert ( transaction . key)
115+ store. graph. dependencies [ transactionState . key, default: [ ] ] . insert ( key)
116+ store. graph. children [ key, default: [ ] ] . insert ( transactionState . key)
117117
118118 return value
119119 }
@@ -189,13 +189,13 @@ internal struct StoreContext {
189189 // Restore dependencies when the refresh is completed.
190190 attachDependencies ( dependencies, for: key)
191191
192- guard let transaction = state. transaction , let cache = lookupCache ( of: atom, for: key) else {
192+ guard let transactionState = state. transactionState , let cache = lookupCache ( of: atom, for: key) else {
193193 checkAndRelease ( for: key)
194194 return value
195195 }
196196
197197 // Notify update unless it's cancelled or terminated by other operations.
198- if !Task. isCancelled && !transaction . isTerminated {
198+ if !Task. isCancelled && !transactionState . isTerminated {
199199 update ( atom: atom, for: key, oldValue: cache. value, newValue: value)
200200 }
201201
@@ -428,7 +428,7 @@ private extension StoreContext {
428428 }
429429 }
430430
431- state? . transaction ? . terminate ( )
431+ state? . transactionState ? . terminate ( )
432432
433433 let context = AtomCurrentContext ( store: self )
434434 state? . effect. released ( context: context)
@@ -486,7 +486,7 @@ private extension StoreContext {
486486 of atom: Node ,
487487 for key: AtomKey
488488 ) -> AtomProducerContext < Node . Produced > {
489- let transaction = Transaction ( key: key) {
489+ let transactionState = TransactionState ( key: key) {
490490 let oldDependencies = detachDependencies ( for: key)
491491
492492 return {
@@ -502,11 +502,11 @@ private extension StoreContext {
502502
503503 let state = getState ( of: atom, for: key)
504504 // Terminate the ongoing transaction first.
505- state. transaction ? . terminate ( )
505+ state. transactionState ? . terminate ( )
506506 // Register the transaction state so it can be terminated from anywhere.
507- state. transaction = transaction
507+ state. transactionState = transactionState
508508
509- return AtomProducerContext ( store: self , transaction : transaction ) { newValue in
509+ return AtomProducerContext ( store: self , transactionState : transactionState ) { newValue in
510510 if let cache = lookupCache ( of: atom, for: key) {
511511 update ( atom: atom, for: key, oldValue: cache. value, newValue: newValue)
512512 }
0 commit comments