Delete Instance.dispose and Instance.reload (#25427)

This commit is contained in:
Kit Langton
2026-05-02 11:44:16 -04:00
committed by GitHub
parent 7371db5cc6
commit 3b9155714d
11 changed files with 30 additions and 47 deletions

View File

@@ -42,17 +42,4 @@ export const Instance = {
restore<R>(ctx: InstanceContext, fn: () => R): R {
return context.provide(ctx, fn)
},
// followup: `reload` survives because `test/server/project-init-git.test.ts`
// spies on this exact method. Once that test asserts on `InstanceStore.reloadInstance`
// (or moves to an Effect runtime), this wrapper can drop.
async reload(input: InstanceStore.LoadInput) {
return InstanceStore.reloadInstance(input)
},
// followup: `dispose` survives for legacy fixtures that read `Instance.current`
// out of ALS (e.g. `test/fixture/fixture.ts` `provideTmpdirInstance`,
// `test/question/question.test.ts` cancellation tests). Convert those to call
// `InstanceStore.disposeInstance(ctx)` directly once `Instance.provide` is gone.
async dispose() {
return InstanceStore.disposeInstance(Instance.current)
},
}

View File

@@ -2,6 +2,7 @@ import { Hono } from "hono"
import { describeRoute, validator } from "hono-openapi"
import { resolver } from "hono-openapi"
import { Instance } from "@/project/instance"
import { InstanceStore } from "@/project/instance-store"
import { Project } from "@/project/project"
import z from "zod"
import { ProjectID } from "@/project/schema"
@@ -81,11 +82,7 @@ export const ProjectRoutes = lazy(() =>
Project.Service.use((svc) => svc.initGit({ directory: dir, project: prev })),
)
if (next.id === prev.id && next.vcs === prev.vcs && next.worktree === prev.worktree) return c.json(next)
await Instance.reload({
directory: dir,
worktree: dir,
project: next,
})
await InstanceStore.reloadInstance({ directory: dir, worktree: dir, project: next })
return c.json(next)
},
)