0.1.3 #4
@@ -32,7 +32,7 @@ export const useInput: {
|
|||||||
yield* useFork(() => Effect.all([
|
yield* useFork(() => Effect.all([
|
||||||
// Sync the upstream state with the internal state
|
// Sync the upstream state with the internal state
|
||||||
// Only mutate the internal state if the upstream value is actually different. This avoids infinite re-render loops.
|
// Only mutate the internal state if the upstream value is actually different. This avoids infinite re-render loops.
|
||||||
Stream.runForEach(Stream.drop(Stream.changesWith(options.ref.changes, Equivalence.strict()), 1), upstreamValue =>
|
Stream.runForEach(Stream.changesWith(options.ref.changes, Equivalence.strict()), upstreamValue =>
|
||||||
Effect.whenEffect(
|
Effect.whenEffect(
|
||||||
Effect.andThen(
|
Effect.andThen(
|
||||||
Schema.encode(options.schema)(upstreamValue),
|
Schema.encode(options.schema)(upstreamValue),
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export const useOptionalInput: {
|
|||||||
yield* useFork(() => Effect.all([
|
yield* useFork(() => Effect.all([
|
||||||
// Sync the upstream state with the internal state
|
// Sync the upstream state with the internal state
|
||||||
// Only mutate the internal state if the upstream value is actually different. This avoids infinite re-render loops.
|
// Only mutate the internal state if the upstream value is actually different. This avoids infinite re-render loops.
|
||||||
Stream.runForEach(Stream.drop(Stream.changesWith(options.ref.changes, Equivalence.strict()), 1), Option.match({
|
Stream.runForEach(Stream.changesWith(options.ref.changes, Equivalence.strict()), Option.match({
|
||||||
onSome: upstreamValue => Effect.whenEffect(
|
onSome: upstreamValue => Effect.whenEffect(
|
||||||
Effect.andThen(
|
Effect.andThen(
|
||||||
Schema.encode(options.schema)(upstreamValue),
|
Schema.encode(options.schema)(upstreamValue),
|
||||||
|
|||||||
Reference in New Issue
Block a user