0.2.6 #49
@@ -76,8 +76,9 @@ export class SynchronizedFormImpl<
|
||||
Schema.decode(this.schema, { errors: "all" })(encodedValue),
|
||||
exit => Effect.andThen(
|
||||
Exit.matchEffect(exit, {
|
||||
onSuccess: v => Lens.set(this.value, Option.some(v)).pipe(
|
||||
Effect.andThen(Lens.set(this.issues, Array.empty())),
|
||||
onSuccess: v => Effect.andThen(
|
||||
Lens.set(this.value, Option.some(v)),
|
||||
Lens.set(this.issues, Array.empty()),
|
||||
),
|
||||
onFailure: c => Option.match(Chunk.findFirst(Cause.failures(c), e => e._tag === "ParseError"), {
|
||||
onSome: e => Effect.flatMap(
|
||||
@@ -108,14 +109,15 @@ export class SynchronizedFormImpl<
|
||||
Stream.runForEach(
|
||||
Stream.drop(this.target.changes, 1),
|
||||
|
||||
targetValue => Schema.encode(this.schema, { errors: "all" })(targetValue).pipe(
|
||||
Effect.flatMap(encodedValue => Effect.whenEffect(
|
||||
targetValue => Effect.flatMap(
|
||||
Schema.encode(this.schema, { errors: "all" })(targetValue),
|
||||
encodedValue => Effect.whenEffect(
|
||||
Lens.set(this.encodedValue, encodedValue),
|
||||
Effect.map(
|
||||
Lens.get(this.encodedValue),
|
||||
currentEncodedValue => !Equal.equals(encodedValue, currentEncodedValue),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
], { concurrency: "unbounded", discard: true }),
|
||||
|
||||
Reference in New Issue
Block a user