@@ -51,19 +51,21 @@ extends Pipeable.Class() implements Form<A, I, R> {
|
||||
}
|
||||
|
||||
makeFieldIssuesSubscribable<const P extends PropertyPath.Paths<A>>(path: P) {
|
||||
const filter = Option.match({
|
||||
onSome: (v: ParseResult.ParseError) => Effect.andThen(
|
||||
ParseResult.ArrayFormatter.formatError(v),
|
||||
Array.filter(issue => PropertyPath.equivalence(issue.path, path)),
|
||||
),
|
||||
onNone: () => Effect.succeed([]),
|
||||
})
|
||||
|
||||
const errorRef = this.errorRef
|
||||
return SubscribableInternal.make({
|
||||
get: Effect.flatMap(errorRef.get, filter),
|
||||
get changes() { return Stream.flatMap(errorRef.changes, filter) },
|
||||
})
|
||||
return pipe(
|
||||
Option.match({
|
||||
onSome: (v: ParseResult.ParseError) => Effect.andThen(
|
||||
ParseResult.ArrayFormatter.formatError(v),
|
||||
Array.filter(issue => PropertyPath.equivalence(issue.path, path)),
|
||||
),
|
||||
onNone: () => Effect.succeed([]),
|
||||
}),
|
||||
|
||||
filter => SubscribableInternal.make({
|
||||
get: Effect.flatMap(errorRef.get, filter),
|
||||
get changes() { return Stream.flatMap(errorRef.changes, filter) },
|
||||
}),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user