0.2.0 #18

Merged
Thilawyn merged 44 commits from next into master 2025-10-24 01:36:27 +02:00
2 changed files with 6 additions and 6 deletions
Showing only changes of commit bb0579408d - Show all commits

View File

@@ -405,15 +405,15 @@ export const withRuntime: {
})
export class ComponentScopeMap extends Effect.Service<ComponentScopeMap>()("effect-fc/Component/ComponentScopeMap", {
export class ScopeMap extends Effect.Service<ScopeMap>()("effect-fc/Component/ScopeMap", {
effect: Effect.bind(
Effect.Do,
"ref",
() => Ref.make(HashMap.empty<string, ComponentScopeMap.Entry>()),
() => Ref.make(HashMap.empty<string, ScopeMap.Entry>()),
),
}) {}
export namespace ComponentScopeMap {
export namespace ScopeMap {
export interface Entry {
readonly scope: Scope.CloseableScope
readonly closeFiber: Option.Option<Fiber.RuntimeFiber<void>>
@@ -432,7 +432,7 @@ export const useScope: {
runtimeRef.current = yield* Effect.runtime()
const key = React.useId()
const scopeMap = yield* ComponentScopeMap as unknown as Effect.Effect<ComponentScopeMap>
const scopeMap = yield* ScopeMap as unknown as Effect.Effect<ScopeMap>
const scope = React.useMemo(() => Runtime.runSync(runtimeRef.current)(Effect.andThen(
scopeMap.ref,

View File

@@ -22,10 +22,10 @@ export const isReactRuntime = (u: unknown): u is ReactRuntime<unknown, unknown>
export const make = <R, ER>(
layer: Layer.Layer<R, ER>,
memoMap?: Layer.MemoMap,
): ReactRuntime<R | Component.ComponentScopeMap, ER> => Object.setPrototypeOf(
): ReactRuntime<R | Component.ScopeMap, ER> => Object.setPrototypeOf(
Object.assign(function() {}, {
runtime: ManagedRuntime.make(
Layer.merge(layer, Component.ComponentScopeMap.Default),
Layer.merge(layer, Component.ScopeMap.Default),
memoMap,
),
// biome-ignore lint/style/noNonNullAssertion: context initialization