Skip to content

Commit fe36cb7

Browse files
committed
fix: resolve conflicts in instance-state.test.ts
1 parent 9f708e7 commit fe36cb7

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

packages/opencode/src/effect/instance-state.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ export const make = <A, E = never, R = never>(
6060

6161
export const get = <A, E, R>(self: InstanceState<A, E, R>) =>
6262
Effect.gen(function* () {
63-
return yield* ScopedCache.get(self.cache, yield* directory)
63+
const ctx = yield* context
64+
return yield* ScopedCache.get(self.cache, ctx.directory).pipe(
65+
Effect.provideService(InstanceRef, ctx),
66+
)
6467
})
6568

6669
export const use = <A, E, R, B>(self: InstanceState<A, E, R>, select: (value: A) => B) => Effect.map(get(self), select)

packages/opencode/test/effect/instance-state.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,11 @@ it.live("InstanceState survives deferred resume from the same instance context",
326326
readonly get: (gate: Deferred.Deferred<void>) => Effect.Effect<string>
327327
}
328328

329-
class Test extends Context.Service<Test, Api>()("@test/DeferredResume") {
330-
static readonly layer = Layer.effect(
331-
Test,
332-
Effect.gen(function* () {
333-
const state = yield* InstanceState.make((ctx) => Effect.sync(() => ctx.directory))
329+
class Test extends Context.Service<Test, Api>()("@test/DeferredResume") {
330+
static readonly layer = Layer.effect(
331+
Test,
332+
Effect.gen(function* () {
333+
const state = yield* InstanceState.make((ctx) => Effect.sync(() => ctx.directory))
334334

335335
return Test.of({
336336
get: Effect.fn("Test.get")(function* (gate: Deferred.Deferred<void>) {

0 commit comments

Comments
 (0)