refactor: use Effect services instead of async facades in provider, auth, and file (#20480)
This commit is contained in:
@@ -24,9 +24,9 @@ export namespace InstanceState {
|
||||
return ((...args: any[]) => Instance.restore(ctx, () => fn(...args))) as F
|
||||
}
|
||||
|
||||
export const context = Effect.fnUntraced(function* () {
|
||||
export const context = Effect.gen(function* () {
|
||||
return (yield* InstanceRef) ?? Instance.current
|
||||
})()
|
||||
})
|
||||
|
||||
export const directory = Effect.map(context, (ctx) => ctx.directory)
|
||||
|
||||
@@ -37,9 +37,9 @@ export namespace InstanceState {
|
||||
const cache = yield* ScopedCache.make<string, A, E, R>({
|
||||
capacity: Number.POSITIVE_INFINITY,
|
||||
lookup: () =>
|
||||
Effect.fnUntraced(function* () {
|
||||
Effect.gen(function* () {
|
||||
return yield* init(yield* context)
|
||||
})(),
|
||||
}),
|
||||
})
|
||||
|
||||
const off = registerDisposer((directory) => Effect.runPromise(ScopedCache.invalidate(cache, directory)))
|
||||
|
||||
Reference in New Issue
Block a user