File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 11import * as Effect from "@effect/io/Effect"
2+ import * as Exit from "@effect/io/Exit"
23import * as Fiber from "@effect/io/Fiber"
34import * as Ref from "@effect/io/Ref"
45import * as Runtime from "@effect/io/Runtime"
@@ -58,13 +59,18 @@ export const makeUseResultCallback: <R>(
5859 } )
5960 )
6061
61- const fiber = Effect . sync ( ( ) => {
62+ const fiber = Stream . suspend ( ( ) => {
6263 setResult ( ( prev ) => updateNext ( Result . waiting ( prev ) , trackRef ) )
64+ return f ( ...args )
6365 } ) . pipe (
64- Stream . flatMap ( ( ) => f ( ...args ) ) ,
6566 Stream . tap ( ( value ) => maybeSetResult ( updateNext ( Result . success ( value ) , trackRef ) ) ) ,
6667 Stream . tapErrorCause ( ( cause ) => maybeSetResult ( updateNext ( Result . failCause ( cause ) , trackRef ) ) ) ,
6768 Stream . runDrain ,
69+ Effect . onExit ( ( exit ) =>
70+ Exit . isInterrupted ( exit )
71+ ? Effect . unit
72+ : Effect . sync ( ( ) => setFiberState ( { _tag : "Idle" } ) )
73+ ) ,
6874 Runtime . runFork ( runtime )
6975 )
7076
You can’t perform that action at this time.
0 commit comments