@@ -2,8 +2,6 @@
|
||||
import { type Context, Effect, Layer, ManagedRuntime, Predicate } from "effect"
|
||||
import * as React from "react"
|
||||
import * as Component from "./Component.js"
|
||||
import * as ErrorObserver from "./ErrorObserver.js"
|
||||
import * as QueryClient from "./QueryClient.js"
|
||||
|
||||
|
||||
export const ReactRuntimeTypeId: unique symbol = Symbol.for("@effect-fc/ReactRuntime/ReactRuntime")
|
||||
@@ -16,18 +14,9 @@ export interface ReactRuntime<R, ER> {
|
||||
readonly context: React.Context<Context.Context<R>>
|
||||
}
|
||||
|
||||
const ReactRuntimeProto = Object.freeze({ [ReactRuntimeTypeId]: ReactRuntimeTypeId } as const)
|
||||
|
||||
export const preludeLayer: Layer.Layer<
|
||||
| Component.ScopeMap
|
||||
| ErrorObserver.ErrorObserver
|
||||
| QueryClient.QueryClient
|
||||
> = Layer.mergeAll(
|
||||
Component.ScopeMap.layer,
|
||||
ErrorObserver.layer,
|
||||
QueryClient.QueryClient.Default,
|
||||
)
|
||||
const ReactRuntimePrototype = Object.freeze({ [ReactRuntimeTypeId]: ReactRuntimeTypeId } as const)
|
||||
|
||||
export const preludeLayer: Layer.Layer<Component.ScopeMap> = Layer.mergeAll(Component.ScopeMap.layer)
|
||||
|
||||
export const isReactRuntime = (u: unknown): u is ReactRuntime<unknown, unknown> => Predicate.hasProperty(u, ReactRuntimeTypeId)
|
||||
|
||||
@@ -43,7 +32,7 @@ export const make = <R, ER>(
|
||||
// biome-ignore lint/style/noNonNullAssertion: context initialization
|
||||
context: React.createContext<Context.Context<R>>(null!),
|
||||
}),
|
||||
ReactRuntimeProto,
|
||||
ReactRuntimePrototype,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user