refactor: use Effect services instead of async facades in provider, auth, and file (#20480)

This commit is contained in:
Kit Langton
2026-04-01 12:13:13 -04:00
committed by GitHub
parent a9c85b7c27
commit 2f405daa98
6 changed files with 86 additions and 89 deletions

View File

@@ -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)))