0.1.3 #4

Merged
Thilawyn merged 90 commits from next into master 2025-08-23 03:07:28 +02:00
2 changed files with 3 additions and 1 deletions
Showing only changes of commit 36c8a01a5d - Show all commits

View File

@@ -41,6 +41,7 @@ export const useInput: {
internalRef.pipe( internalRef.pipe(
Effect.andThen(Schema.decode(options.schema)), Effect.andThen(Schema.decode(options.schema)),
Effect.andThen(decodedInternalValue => !(options.equivalence ?? Equal.equals)(upstreamValue, decodedInternalValue)), Effect.andThen(decodedInternalValue => !(options.equivalence ?? Equal.equals)(upstreamValue, decodedInternalValue)),
Effect.catchTag("ParseError", () => Effect.succeed(false)),
), ),
) )
), ),

View File

@@ -49,7 +49,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 encoded 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(options.ref.changes, Option.match({ Stream.runForEach(options.ref.changes, Option.match({
onSome: upstreamValue => Effect.whenEffect( onSome: upstreamValue => Effect.whenEffect(
Effect.andThen( Effect.andThen(
@@ -59,6 +59,7 @@ export const useOptionalInput: {
internalRef.pipe( internalRef.pipe(
Effect.andThen(Schema.decode(options.schema)), Effect.andThen(Schema.decode(options.schema)),
Effect.andThen(decodedInternalValue => !(options.equivalence ?? Equal.equals)(upstreamValue, decodedInternalValue)), Effect.andThen(decodedInternalValue => !(options.equivalence ?? Equal.equals)(upstreamValue, decodedInternalValue)),
Effect.catchTag("ParseError", () => Effect.succeed(false)),
), ),
), ),