Skip to content

Commit

Permalink
Fix Suspense
Browse files Browse the repository at this point in the history
  • Loading branch information
davesnx committed Aug 2, 2023
1 parent 74de672 commit 4117f59
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/react/src/react.ml
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,12 @@ let createContext (initial_value : 'a) : 'a context =
{ current_value = ref_value; provider; consumer }

module Suspense = struct
let make ~fallback ~children = Suspense { fallback; children }
end [@react.component]
let or_react_null = function None -> null | Some x -> x

let make ?fallback ?children () =
Suspense
{ fallback = or_react_null fallback; children = or_react_null children }
end

(* let memo f : 'props * 'props -> bool = f
let memoCustomCompareProps f _compare : 'props * 'props -> bool = f *)
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/react.mli
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type 'a context = {
val createContext : 'a -> 'a context

module Suspense : sig
val make : fallback:element -> children:element -> element
val make : ?fallback:element -> ?children:element -> unit -> element
end

type any_promise = Any_promise : 'a Lwt.t -> any_promise
Expand Down

0 comments on commit 4117f59

Please sign in to comment.