Fix
Lint / lint (push) Successful in 14s

This commit is contained in:
Julien Valverdé
2026-06-04 16:10:02 +02:00
parent d353b12bbb
commit 6d30065a07
3 changed files with 28 additions and 31 deletions
+9 -9
View File
@@ -212,24 +212,24 @@ export const unsafeForkEffect = Effect.fnUntraced(function* <A, E, R, P = never>
never, never,
Scope.Scope | unsafeForkEffect.OutputContext<R, P> Scope.Scope | unsafeForkEffect.OutputContext<R, P>
> { > {
const ref = yield* SynchronizedRef.make<Result<A, E, P>>(options?.initial ?? initial<A, E, P>()) const ref = (yield* SynchronizedRef.make(
options?.initial ?? initial<A, E, P>()
)) as Lens.SynchronizedRefLensImpl.SynchronizedRefWithInternals<Result<A, E, P>>
const pubsub = yield* PubSub.unbounded<Result<A, E, P>>() const pubsub = yield* PubSub.unbounded<Result<A, E, P>>()
const state = Lens.make<Result<A, E, P>, never, never, never, never>({ const state = Lens.make<Result<A, E, P>, never, never, never, never>({
get get() { return Ref.get(ref) }, get get() { return Ref.get(ref.ref) },
get changes() { get changes() {
return Stream.unwrapScoped(Effect.map( return Stream.unwrapScoped(Effect.map(
Effect.all([Ref.get(ref), Stream.fromPubSub(pubsub, { scoped: true })]), Effect.all([Ref.get(ref.ref), Stream.fromPubSub(pubsub, { scoped: true })]),
([latest, stream]) => Stream.concat(Stream.make(latest), stream), ([latest, stream]) => Stream.concat(Stream.make(latest), stream),
)) ))
}, },
modify: f => Ref.get(ref).pipe( commit: value => Effect.zipLeft(
Effect.flatMap(f), Ref.set(ref.ref, value),
Effect.flatMap(([b, a]) => Ref.set(ref, a).pipe( PubSub.publish(pubsub, value),
Effect.as(b),
Effect.zipLeft(PubSub.publish(pubsub, a))
)),
), ),
lock: Effect.succeed(ref.withLock),
}) })
const fiber = yield* Effect.gen(function*() { const fiber = yield* Effect.gen(function*() {
+16 -19
View File
@@ -53,27 +53,24 @@ extends Pipeable.Class() implements SubmittableForm<A, I, R, MA, ME, MR, MP> {
) { ) {
super() super()
this.encodedValue = Effect.succeed(this).pipe( this.encodedValue = Effect.all([
Effect.map(self => Lens.make<I, never, never, never, never>({ Effect.succeed(this),
get get() { return self.internalEncodedValue.get }, Effect.succeed(Lens.asLensImpl(this.internalEncodedValue)),
get changes() { return self.internalEncodedValue.changes }, ]).pipe(
modify: f => self.internalEncodedValue.modify( Effect.map(([self, parent]) => Lens.make({
encodedValue => Effect.map( get: parent.get,
f(encodedValue), get changes() { return parent.changes },
([b, nextEncodedValue]) => [ commit: a => Effect.andThen(
[b, nextEncodedValue] as const, Effect.flatMap(
nextEncodedValue, parent.resolve,
] as const, resolved => resolved.commit(Effect.succeed(a)),
) ),
).pipe( self.synchronizeEncodedValue(a).pipe(
Effect.tap(([, nextEncodedValue]) => Effect.forkScoped,
self.synchronizeEncodedValue(nextEncodedValue).pipe( Effect.provide(self.context),
Effect.forkScoped,
Effect.provide(self.context),
)
), ),
Effect.map(([b]) => b),
), ),
lock: parent.lock,
})), })),
Lens.unwrap, Lens.unwrap,
) )
+3 -3
View File
@@ -15,7 +15,7 @@ export interface SynchronizedForm<
in out TEW = never, in out TEW = never,
in out TRR = never, in out TRR = never,
in out TRW = never, in out TRW = never,
> extends Form.Form<readonly [], A, I, TER, TEW> { > extends Form.Form<readonly [], A, I, TER, TER | TEW> {
readonly [SynchronizedFormTypeId]: SynchronizedFormTypeId readonly [SynchronizedFormTypeId]: SynchronizedFormTypeId
readonly schema: Schema.Schema<A, I, R> readonly schema: Schema.Schema<A, I, R>
@@ -41,7 +41,7 @@ export class SynchronizedFormImpl<
readonly path = [] as const readonly path = [] as const
readonly value: Subscribable.Subscribable<Option.Option<A>, never, never> readonly value: Subscribable.Subscribable<Option.Option<A>, never, never>
readonly encodedValue: Lens.Lens<I, TER, TEW, never, never> readonly encodedValue: Lens.Lens<I, TER, TER | TEW, never, never>
readonly isValidating: Subscribable.Subscribable<boolean, never, never> readonly isValidating: Subscribable.Subscribable<boolean, never, never>
readonly canCommit: Subscribable.Subscribable<boolean, never, never> readonly canCommit: Subscribable.Subscribable<boolean, never, never>
@@ -78,7 +78,7 @@ export class SynchronizedFormImpl<
Effect.succeed(this), Effect.succeed(this),
Effect.succeed(Lens.asLensImpl(this.internalEncodedValue)), Effect.succeed(Lens.asLensImpl(this.internalEncodedValue)),
]).pipe( ]).pipe(
Effect.map(([self, parent]) => Lens.make({ Effect.map(([self, parent]) => Lens.make<I, TER, TER | TEW, never, never>({
get: parent.get, get: parent.get,
get changes() { return parent.changes }, get changes() { return parent.changes },
commit: a => Effect.andThen( commit: a => Effect.andThen(