From 3290a63ded1cba82934389aa59f4ae3a9942c29d Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Mon, 25 Nov 2024 19:42:13 +0100 Subject: [PATCH 1/2] Add unwrap into useOptimistic --- src/React.re | 2 +- src/React.rei | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/React.re b/src/React.re index ae8cd326e..78feba2c4 100644 --- a/src/React.re +++ b/src/React.re @@ -905,7 +905,7 @@ module Experimental = { /* https://react.dev/reference/react/useOptimistic */ [@mel.module "react"] external useOptimistic: - ('state, ('state, 'optimisticValue) => 'state) => + ('state, [@mel.uncurry] (('state, 'optimisticValue) => 'state)) => ('state, 'optimisticValue => unit) = "useOptimistic"; diff --git a/src/React.rei b/src/React.rei index 66b4de0ee..24a9ccc24 100644 --- a/src/React.rei +++ b/src/React.rei @@ -586,7 +586,7 @@ module Experimental: { [@mel.module "react"] external useOptimistic: - ('state, ('state, 'optimisticValue) => 'state) => + ('state, [@mel.uncurry] (('state, 'optimisticValue) => 'state)) => ('state, 'optimisticValue => unit) = "useOptimistic"; From c6b16dcff0ee56cc0049e982e10425e1859bfb23 Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Mon, 25 Nov 2024 19:42:23 +0100 Subject: [PATCH 2/2] Add unit and unwrap to useActionState --- src/React.re | 7 ++++++- src/React.rei | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/React.re b/src/React.re index 78feba2c4..fc8fe9319 100644 --- a/src/React.re +++ b/src/React.re @@ -959,7 +959,12 @@ module Experimental = { /* https://react.dev/reference/react/useActionState */ [@mel.module "react"] external useActionState: - (('state, FormData.t) => unit, 'state, ~permalink: bool=?) => + ( + [@mel.uncurry] (('state, FormData.t) => unit), + 'state, + ~permalink: bool=?, + unit + ) => ('state, formAction, bool) = "useActionState"; }; diff --git a/src/React.rei b/src/React.rei index 24a9ccc24..8a83eebe1 100644 --- a/src/React.rei +++ b/src/React.rei @@ -644,7 +644,12 @@ module Experimental: { [@mel.module "react"] external useActionState: - (('state, FormData.t) => unit, 'state, ~permalink: bool=?) => + ( + [@mel.uncurry] (('state, FormData.t) => unit), + 'state, + ~permalink: bool=?, + unit + ) => ('state, formAction, bool) = "useActionState"; };