Cleanup
All checks were successful
Lint / lint (push) Successful in 11s

This commit is contained in:
Julien Valverdé
2025-07-17 17:22:46 +02:00
parent 09cb9a4607
commit c2e9572044
3 changed files with 0 additions and 30 deletions

View File

@@ -13,9 +13,6 @@
"packages/effect-fc": { "packages/effect-fc": {
"name": "effect-fc", "name": "effect-fc",
"version": "0.1.0", "version": "0.1.0",
"dependencies": {
"@typed/async-data": "^0.13.1",
},
"devDependencies": { "devDependencies": {
"@effect/language-service": "^0.23.3", "@effect/language-service": "^0.23.3",
}, },

View File

@@ -40,8 +40,5 @@
}, },
"devDependencies": { "devDependencies": {
"@effect/language-service": "^0.23.3" "@effect/language-service": "^0.23.3"
},
"dependencies": {
"@typed/async-data": "^0.13.1"
} }
} }

View File

@@ -1,4 +1,3 @@
import * as AsyncData from "@typed/async-data"
import { type Context, Effect, Equivalence, ExecutionStrategy, Exit, type Layer, Option, pipe, PubSub, Ref, Runtime, Scope, Stream, SubscriptionRef } from "effect" import { type Context, Effect, Equivalence, ExecutionStrategy, Exit, type Layer, Option, pipe, PubSub, Ref, Runtime, Scope, Stream, SubscriptionRef } from "effect"
import * as React from "react" import * as React from "react"
import { SetStateAction } from "./types/index.js" import { SetStateAction } from "./types/index.js"
@@ -197,29 +196,6 @@ export const useContext: {
), [scope]) ), [scope])
}) })
export const useContextAsync: {
<ROut, E, RIn>(
layer: Layer.Layer<ROut, E, RIn>,
options?: ScopeOptions,
): Effect.Effect<AsyncData.AsyncData<Context.Context<ROut>, E>, never, Exclude<RIn, Scope.Scope>>
} = Effect.fn("useContextAsync")(function* <ROut, E, RIn>(
layer: Layer.Layer<ROut, E, RIn>,
options?: ScopeOptions,
) {
const [context, setContext] = React.useState<AsyncData.AsyncData<Context.Context<ROut>, E>>(AsyncData.noData())
yield* useFork(() => Effect.sync(() => setContext(AsyncData.loading())).pipe(
Effect.andThen(Effect.provide(Effect.context<ROut>(), layer)),
Effect.match({
onSuccess: v => AsyncData.success(v),
onFailure: e => AsyncData.fail(e),
}),
Effect.andThen(setContext),
), [layer], options)
return context
})
export const useRefFromReactiveValue: { export const useRefFromReactiveValue: {
<A>(value: A): Effect.Effect<SubscriptionRef.SubscriptionRef<A>> <A>(value: A): Effect.Effect<SubscriptionRef.SubscriptionRef<A>>