0.2.2 #31
@@ -271,22 +271,21 @@ export const makeFormField = <A, I, R, MA, ME, MR, MP, const P extends PropertyP
|
|||||||
self: Form<A, I, R, MA, ME, MR, MP>,
|
self: Form<A, I, R, MA, ME, MR, MP>,
|
||||||
path: P,
|
path: P,
|
||||||
): FormField<PropertyPath.ValueFromPath<A, P>, PropertyPath.ValueFromPath<I, P>> => {
|
): FormField<PropertyPath.ValueFromPath<A, P>, PropertyPath.ValueFromPath<I, P>> => {
|
||||||
const _self = self as FormImpl<A, I, R, MA, ME, MR, MP>
|
|
||||||
return new FormFieldImpl(
|
return new FormFieldImpl(
|
||||||
Subscribable.mapEffect(_self.value, Option.match({
|
Subscribable.mapEffect(self.value, Option.match({
|
||||||
onSome: v => Option.map(PropertyPath.get(v, path), Option.some),
|
onSome: v => Option.map(PropertyPath.get(v, path), Option.some),
|
||||||
onNone: () => Option.some(Option.none()),
|
onNone: () => Option.some(Option.none()),
|
||||||
})),
|
})),
|
||||||
SubscriptionSubRef.makeFromPath(_self.encodedValue, path),
|
SubscriptionSubRef.makeFromPath(self.encodedValue, path),
|
||||||
Subscribable.mapEffect(_self.error, Option.match({
|
Subscribable.mapEffect(self.error, Option.match({
|
||||||
onSome: flow(
|
onSome: flow(
|
||||||
ParseResult.ArrayFormatter.formatError,
|
ParseResult.ArrayFormatter.formatError,
|
||||||
Effect.map(Array.filter(issue => PropertyPath.equivalence(issue.path, path))),
|
Effect.map(Array.filter(issue => PropertyPath.equivalence(issue.path, path))),
|
||||||
),
|
),
|
||||||
onNone: () => Effect.succeed([]),
|
onNone: () => Effect.succeed([]),
|
||||||
})),
|
})),
|
||||||
Subscribable.map(_self.validationFiber, Option.isSome),
|
Subscribable.map(self.validationFiber, Option.isSome),
|
||||||
Subscribable.map(_self.mutation.result, result => Result.isRunning(result) || Result.hasRefreshingFlag(result)),
|
Subscribable.map(self.mutation.result, result => Result.isRunning(result) || Result.hasRefreshingFlag(result)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user