fix(instance): run bootstrap from instance store (#25475)
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
import { Instance } from "../project/instance"
|
||||
import { InstanceStore } from "../project/instance-store"
|
||||
import { getBootstrapRunEffect } from "../effect/app-runtime"
|
||||
import { InstanceRuntime } from "../project/instance-runtime"
|
||||
|
||||
export async function bootstrap<T>(directory: string, cb: () => Promise<T>) {
|
||||
return Instance.provide({
|
||||
directory,
|
||||
init: await getBootstrapRunEffect(),
|
||||
fn: async () => {
|
||||
try {
|
||||
const result = await cb()
|
||||
return result
|
||||
} finally {
|
||||
await InstanceStore.disposeInstance(Instance.current)
|
||||
await InstanceRuntime.disposeInstance(Instance.current)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user