0.2.6 #49

Merged
Thilawyn merged 48 commits from next into master 2026-05-04 02:10:53 +02:00
Showing only changes of commit 840e82debc - Show all commits

View File

@@ -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 }),