From f49a463bb042156a6d0fda46485d6a6b4a08b6dc Mon Sep 17 00:00:00 2001 From: Stephanos Komnenos Date: Fri, 27 Jun 2025 19:19:23 +0000 Subject: [PATCH 1/2] Keep `useTransition` backward compatibility --- src/React.res | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/React.res b/src/React.res index f1f6831..c0e80da 100644 --- a/src/React.res +++ b/src/React.res @@ -411,13 +411,17 @@ external displayName: component<'props> => option = "displayName" // Actions -type transitionFunction = unit => promise - +type transitionFunction = unit => unit type transitionStartFunction = transitionFunction => unit +type transitionFunctionAsync = unit => promise +type transitionStartFunctionAsync = transitionFunctionAsync => unit + /** `useTransition` is a React Hook that lets you render a part of the UI in the background. */ @module("react") external useTransition: unit => (bool, transitionStartFunction) = "useTransition" +@module("react") +external useTransitionAsync: unit => (bool, transitionStartFunctionAsync) = "useTransition" type action<'state, 'payload> = ('state, 'payload) => promise<'state> From a9c7bb14e0c1aa303de41038cf256fc207287369 Mon Sep 17 00:00:00 2001 From: Stephanos Komnenos Date: Fri, 27 Jun 2025 19:29:39 +0000 Subject: [PATCH 2/2] Add `startTransition` --- src/React.res | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/React.res b/src/React.res index c0e80da..0676012 100644 --- a/src/React.res +++ b/src/React.res @@ -417,6 +417,12 @@ type transitionStartFunction = transitionFunction => unit type transitionFunctionAsync = unit => promise type transitionStartFunctionAsync = transitionFunctionAsync => unit +/** `startTransition` lets you render a part of the UI in the background. */ +@module("react") +external startTransition: transitionStartFunction = "startTransition" +@module("react") +external startTransitionAsync: transitionStartFunctionAsync = "startTransition" + /** `useTransition` is a React Hook that lets you render a part of the UI in the background. */ @module("react") external useTransition: unit => (bool, transitionStartFunction) = "useTransition"