0.2.6 #49
@@ -1,4 +1,4 @@
|
||||
import { Array, type Context, Effect, Fiber, Option, ParseResult, Pipeable, Predicate, Schema, type Scope, Stream, SubscriptionRef } from "effect"
|
||||
import { Array, type Context, Effect, Equal, Fiber, Option, ParseResult, Pipeable, Predicate, Schema, type Scope, Stream, SubscriptionRef } from "effect"
|
||||
import * as Form from "./Form.js"
|
||||
import * as Lens from "./Lens.js"
|
||||
import * as Subscribable from "./Subscribable.js"
|
||||
@@ -148,36 +148,25 @@ export class SynchronizedFormImpl<
|
||||
}
|
||||
|
||||
get run(): Effect.Effect<void, TER> {
|
||||
return Effect.void
|
||||
// return this.runSemaphore.withPermits(1)(Effect.provide(
|
||||
// Effect.andThen(
|
||||
// Effect.flatMap(
|
||||
// Lens.get(this.internalEncodedValue),
|
||||
// encodedValue => this.synchronizeEncodedValue(encodedValue),
|
||||
// ),
|
||||
// Stream.runForEach(
|
||||
// Stream.drop(this.target.changes, 1),
|
||||
|
||||
// targetValue => Schema.encode(this.schema, { errors: "all" })(targetValue).pipe(
|
||||
// Effect.flatMap(encodedValue => Effect.andThen(
|
||||
// Effect.whenEffect(
|
||||
// Lens.set(this.internalEncodedValue, encodedValue),
|
||||
// Effect.map(
|
||||
// Lens.get(this.internalEncodedValue),
|
||||
// currentEncodedValue => !Equal.equals(encodedValue, currentEncodedValue),
|
||||
// ),
|
||||
// ),
|
||||
// Effect.andThen(
|
||||
// Lens.set(this.issues, Array.empty()),
|
||||
// ),
|
||||
// )),
|
||||
// Effect.ignore,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
|
||||
// this.context,
|
||||
// ))
|
||||
return this.runSemaphore.withPermits(1)(Effect.provide(
|
||||
Stream.runForEach(
|
||||
Stream.drop(this.target.changes, 1),
|
||||
targetValue => Schema.encode(this.schema, { errors: "all" })(targetValue).pipe(
|
||||
Effect.flatMap(encodedValue => Effect.andThen(
|
||||
Effect.whenEffect(
|
||||
Lens.set(this.internalEncodedValue, encodedValue),
|
||||
Effect.map(
|
||||
Lens.get(this.internalEncodedValue),
|
||||
currentEncodedValue => !Equal.equals(encodedValue, currentEncodedValue),
|
||||
),
|
||||
),
|
||||
Lens.set(this.issues, Array.empty()),
|
||||
)),
|
||||
Effect.ignore,
|
||||
),
|
||||
),
|
||||
this.context,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user