diff options
| author | Dax Raad <[email protected]> | 2025-11-02 13:22:58 -0500 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-11-02 13:22:58 -0500 |
| commit | 894cbaa51e48500862abc08df7d58521eba280a7 (patch) | |
| tree | f17dcdf77592bbd3c4b2ff2206fdc4f8fbbbee25 | |
| parent | 8b70b89fde5a6706ffe9b1a1fa1fd22ddf4b8cfb (diff) | |
| download | opencode-894cbaa51e48500862abc08df7d58521eba280a7.tar.gz opencode-894cbaa51e48500862abc08df7d58521eba280a7.zip | |
fix duplicate plugin subscriptions
| -rw-r--r-- | packages/opencode/src/project/instance.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/opencode/src/project/instance.ts b/packages/opencode/src/project/instance.ts index 3b99a5fa1..ce9a57d17 100644 --- a/packages/opencode/src/project/instance.ts +++ b/packages/opencode/src/project/instance.ts @@ -12,7 +12,11 @@ const context = Context.create<Context>("instance") const cache = new Map<string, Context>() export const Instance = { - async provide<R>(input: { directory: string; init?: () => Promise<any>; fn: () => R }): Promise<R> { + async provide<R>(input: { + directory: string + init?: () => Promise<any> + fn: () => R + }): Promise<R> { let existing = cache.get(input.directory) if (!existing) { const project = await Project.fromDirectory(input.directory) @@ -24,8 +28,8 @@ export const Instance = { } return context.provide(existing, async () => { if (!cache.has(input.directory)) { - await input.init?.() cache.set(input.directory, existing) + await input.init?.() } return input.fn() }) |
