File tree Expand file tree Collapse file tree 1 file changed +21
-16
lines changed
Sources/ComposableArchitecture Expand file tree Collapse file tree 1 file changed +21
-16
lines changed Original file line number Diff line number Diff line change 263263 self . receivedActions. append ( ( action, state) )
264264 }
265265
266- let effect = LongLivingEffect ( file: action. file, line: action. line)
267- return
268- effects
269- . handleEvents (
270- receiveSubscription: { [ effectDidSubscribe = self . effectDidSubscribe, weak self] _ in
271- self ? . inFlightEffects. insert ( effect)
272- Task {
273- await Task . megaYield ( )
274- effectDidSubscribe. continuation. yield ( )
275- }
276- } ,
277- receiveCompletion: { [ weak self] _ in self ? . inFlightEffects. remove ( effect) } ,
278- receiveCancel: { [ weak self] in self ? . inFlightEffects. remove ( effect) }
279- )
280- . eraseToEffect { . init( origin: . receive( $0) , file: action. file, line: action. line) }
281-
266+ switch effects. operation {
267+ case . none:
268+ return . none
269+ case . publisher, . run:
270+ let effect = LongLivingEffect ( file: action. file, line: action. line)
271+ return
272+ effects
273+ . handleEvents (
274+ receiveSubscription: {
275+ [ effectDidSubscribe = self . effectDidSubscribe, weak self] _ in
276+ self ? . inFlightEffects. insert ( effect)
277+ Task {
278+ await Task . megaYield ( )
279+ effectDidSubscribe. continuation. yield ( )
280+ }
281+ } ,
282+ receiveCompletion: { [ weak self] _ in self ? . inFlightEffects. remove ( effect) } ,
283+ receiveCancel: { [ weak self] in self ? . inFlightEffects. remove ( effect) }
284+ )
285+ . eraseToEffect { . init( origin: . receive( $0) , file: action. file, line: action. line) }
286+ }
282287 } ,
283288 environment: ( )
284289 )
You can’t perform that action at this time.
0 commit comments