From 75e67dc6a6c41f80f91379bbbb4066c7717380d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Thu, 28 May 2026 20:30:17 +0200 Subject: [PATCH] Fix --- packages/effect-lens/src/Lens.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/effect-lens/src/Lens.ts b/packages/effect-lens/src/Lens.ts index f6a213b..9959aa1 100644 --- a/packages/effect-lens/src/Lens.ts +++ b/packages/effect-lens/src/Lens.ts @@ -193,17 +193,18 @@ extends LensImpl { get resolve(): Effect.Effect, never, never> { return Effect.map( - this.ref.get, + Ref.get(this.ref.ref), value => ({ value, - commit: next => Effect.flatMap(next, value => this.commit(value)), + commit: next => Effect.flatMap( + next, + value => Ref.set(this.ref.ref, value), + ), }), ) } - get changes() { return Stream.unwrap(Effect.map(this.ref.get, Stream.make)) } + get changes() { return Stream.unwrap(Effect.map(Ref.get(this.ref.ref), Stream.make)) } get withLock() { return this.ref.withLock } - - commit(a: A) { return Ref.set(this.ref.ref, a) } } /** @@ -239,19 +240,18 @@ extends LensImpl { this.ref.get, value => ({ value, - commit: next => Effect.flatMap(next, value => this.commit(value)), + commit: next => Effect.flatMap( + next, + value => Effect.zipLeft( + Ref.set(this.ref.ref, value), + PubSub.publish(this.ref.pubsub, value), + ), + ), }), ) } get changes() { return this.ref.changes } get withLock() { return this.ref.semaphore.withPermits(1) } - - commit(a: A) { - return Effect.zipLeft( - Ref.set(this.ref.ref, a), - PubSub.publish(this.ref.pubsub, a), - ) - } } /**