This commit is contained in:
@@ -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 Form from "./Form.js"
|
||||||
import * as Lens from "./Lens.js"
|
import * as Lens from "./Lens.js"
|
||||||
import * as Subscribable from "./Subscribable.js"
|
import * as Subscribable from "./Subscribable.js"
|
||||||
@@ -148,36 +148,25 @@ export class SynchronizedFormImpl<
|
|||||||
}
|
}
|
||||||
|
|
||||||
get run(): Effect.Effect<void, TER> {
|
get run(): Effect.Effect<void, TER> {
|
||||||
return Effect.void
|
return this.runSemaphore.withPermits(1)(Effect.provide(
|
||||||
// return this.runSemaphore.withPermits(1)(Effect.provide(
|
Stream.runForEach(
|
||||||
// Effect.andThen(
|
Stream.drop(this.target.changes, 1),
|
||||||
// Effect.flatMap(
|
targetValue => Schema.encode(this.schema, { errors: "all" })(targetValue).pipe(
|
||||||
// Lens.get(this.internalEncodedValue),
|
Effect.flatMap(encodedValue => Effect.andThen(
|
||||||
// encodedValue => this.synchronizeEncodedValue(encodedValue),
|
Effect.whenEffect(
|
||||||
// ),
|
Lens.set(this.internalEncodedValue, encodedValue),
|
||||||
// Stream.runForEach(
|
Effect.map(
|
||||||
// Stream.drop(this.target.changes, 1),
|
Lens.get(this.internalEncodedValue),
|
||||||
|
currentEncodedValue => !Equal.equals(encodedValue, currentEncodedValue),
|
||||||
// targetValue => Schema.encode(this.schema, { errors: "all" })(targetValue).pipe(
|
),
|
||||||
// Effect.flatMap(encodedValue => Effect.andThen(
|
),
|
||||||
// Effect.whenEffect(
|
Lens.set(this.issues, Array.empty()),
|
||||||
// Lens.set(this.internalEncodedValue, encodedValue),
|
)),
|
||||||
// Effect.map(
|
Effect.ignore,
|
||||||
// Lens.get(this.internalEncodedValue),
|
),
|
||||||
// currentEncodedValue => !Equal.equals(encodedValue, currentEncodedValue),
|
),
|
||||||
// ),
|
this.context,
|
||||||
// ),
|
))
|
||||||
// Effect.andThen(
|
|
||||||
// Lens.set(this.issues, Array.empty()),
|
|
||||||
// ),
|
|
||||||
// )),
|
|
||||||
// Effect.ignore,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
|
|
||||||
// this.context,
|
|
||||||
// ))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user