Skip to content

[new release] server-reason-react (0.5.0)#29631

Open
davesnx wants to merge 1 commit intoocaml:masterfrom
davesnx:release-server-reason-react-0.5.0
Open

[new release] server-reason-react (0.5.0)#29631
davesnx wants to merge 1 commit intoocaml:masterfrom
davesnx:release-server-reason-react-0.5.0

Conversation

@davesnx
Copy link
Copy Markdown
Contributor

@davesnx davesnx commented Apr 1, 2026

Rendering React components on the server natively

CHANGES:

@davesnx davesnx force-pushed the release-server-reason-react-0.5.0 branch 2 times, most recently from 97a25a4 to 349a37b Compare April 1, 2026 23:40
"odoc" {with-doc}
"ocamlformat" {= "0.28.1" & with-test}
"ocaml-lsp-server" {with-dev-setup}
"dream" {= "1.0.0~alpha8" & with-dev-setup}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like dream is now a strict with-test dependency:
https://opam.ci.ocaml.org/github/ocaml/opam-repository/commit/349a37baa45c59815f2dc7b56e76ea0458925ba8/variant/compilers,5.4,server-reason-react.0.5.0,tests

#=== ERROR while compiling server-reason-react.0.5.0 ==========================#
# context              2.5.0 | linux/x86_64 | ocaml-base-compiler.5.4.1 | pinned(https://github.com/ml-in-barcelona/server-reason-react/releases/download/0.5.0/server-reason-react-0.5.0.tbz)
# path                 ~/.opam/5.4/.opam-switch/build/server-reason-react.0.5.0
# command              ~/.opam/opam-init/hooks/sandbox.sh build dune build -p server-reason-react -j 71 @install @runtest
# exit-code            1
# env-file             ~/.opam/log/server-reason-react-8-847dd1.env
# output-file          ~/.opam/log/server-reason-react-8-847dd1.out
### output ###
# File "demo/dream-nested-router/dune", line 5, characters 2-7:
# 5 |   dream
#       ^^^^^
# Error: Library "dream" not found.
# -> required by _build/default/demo/dream-nested-router/test_router_rsc.exe
# -> required by alias demo/dream-nested-router/runtest-test_router_rsc in
#    demo/dream-nested-router/dune:2
# -> required by alias demo/dream-nested-router/runtest

I don't know if with-test subsumes with-dev-setup though - or if one should state (with-test | with-dev-setup) 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wops, a dev only library sneak out. Pushing a fix

@davesnx davesnx force-pushed the release-server-reason-react-0.5.0 branch from 349a37b to 63d5257 Compare April 2, 2026 14:06
@mseri
Copy link
Copy Markdown
Member

mseri commented Apr 3, 2026

Tests are failing (though not completely consistently) with

# File "packages/server-reason-react-ppx/cram/client-component-on-the-client-nested.t/run.t", line 1, characters 0-0:
# /usr/bin/git --no-pager diff --no-index --color=always -u _build/default/packages/server-reason-react-ppx/cram/client-component-on-the-client-nested.t/run.t _build/default/packages/server-reason-react-ppx/cram/client-component-on-the-client-nested.t/run.t.corrected
# diff --git a/_build/default/packages/server-reason-react-ppx/cram/client-component-on-the-client-nested.t/run.t b/_build/default/packages/server-reason-react-ppx/cram/client-component-on-the-client-nested.t/run.t.corrected
# index 6b2b087..ab63277 100644
# --- a/_build/default/packages/server-reason-react-ppx/cram/client-component-on-the-client-nested.t/run.t
# +++ b/_build/default/packages/server-reason-react-ppx/cram/client-component-on-the-client-nested.t/run.t.corrected
# @@ -23,7 +23,7 @@
#        use_vmthreads: false,
#        recursive_types: false,
#        principal: false,
# -      no_alias_deps: false,
# +      transparent_modules: false,
#        unboxed_types: false,
#        unsafe_string: false,
#        cookies: [],

Is that expected?

Also, a revdep (styled-ppx) is failing with

# (cd _build/default && /home/opam/.opam/4.14/bin/ocamlc.opt -w -40 -g -bin-annot -I demo/melange/lib/native/.lib_native.objs/byte -I /home/opam/.opam/4.14/lib/server-reason-react/belt -I /home/opam/.opam/4.14/lib/server-reason-react/js -I /home/opam/.opam/4.14/lib/server-reason-react/react -I /home/opam/.opam/4.14/lib/server-reason-react/reactDom -I packages/runtime/native/.styled_ppx_runtime_native.objs/byte -no-alias-deps -o demo/melange/lib/native/.lib_native.objs/byte/main.cmo -c -impl demo/melange/lib/native/Main.re.pp.ml)
# File "demo/melange/lib/native/Main.re", line 114, characters 6-14:
# 114 |       <Cositas as_="section" lola={CSS.px(10)}>
#             ^^^^^^^^
# Error: Unbound value Cositas.makeProps

Is this related to this release?

@davesnx
Copy link
Copy Markdown
Contributor Author

davesnx commented Apr 3, 2026

Yeah, need to add a upper bound in styled-ppx for the ci to pass

CHANGES:

* Support Promise caching in react.client.components by @davesnx
* Reorder head content exactly like react-dom/server by @davesnx
* Implement hydration-compatible `useId` using React's tree-position-based algorithm, matching React 19 output. Adds `?identifier_prefix` to `renderToString`, `renderToStaticMarkup`, `renderToStream` and `render_html`. Fixes ml-in-barcelona/server-reason-react#93
* Fix `renderToString` rendering Suspense children twice (once as trial, once with markers) due to side-effectful match expression. Children are now rendered into a separate buffer
* Change shape for React.Event.* since Js.t is now supported. All methods fail at runtime with `Runtime.fail_impossible_action_in_ssr`
* [server-reason-react.ppx] Strip units at any position (supporting mlx difference with [@jsx] transformations)
* Add runtime error with clear message when `React.cloneElement` is used with uppercase components by @davesnx
* Allow `[@platform js]` and `[@browser_only]` on externals to conditionally exclude them from native builds. Fixes ml-in-barcelona/server-reason-react#170 by @davesnx
* Generate `makeProps` in the PPX by @davesnx in ml-in-barcelona/server-reason-react#364
* Implement `Js.t` natively with `Js.Internal` and a type registry by @davesnx in ml-in-barcelona/server-reason-react#363
* Add `React.useActionState` by @davesnx
* Add `key` into client components by @davesnx
* Fix several functions in Belt to match specification (`Belt.Array.setExn`, `Belt.Array.concat`, `Belt.MutableMap.remove`, `Belt.HashMap.keepMapInPlace`, and avoid double callback evaluation) by @yasunariw in ml-in-barcelona/server-reason-react#362
* Implement `Belt.Array.getUndefined` and annotate `Belt.Array.push` as not implemented by @davesnx
* Remove deprecated folder from Belt and reorganise Belt tests by @davesnx
* Fix leaking `was_previous` when node was closing by @davesnx in ml-in-barcelona/server-reason-react#361
* Fix `React.cloneElement` on `Static {}` components by @davesnx in ml-in-barcelona/server-reason-react#359
* Require ppxlib >= 0.36 by @davesnx
@mseri
Copy link
Copy Markdown
Member

mseri commented Apr 4, 2026

Thanks a lot. One last noisy cram test failure:

# File "packages/melange.ppx/tests/mel_send_pipe.t", line 1, characters 0-0:
# /usr/sbin/git --no-pager diff --no-index --color=always -u _build/default/packages/melange.ppx/tests/mel_send_pipe.t _build/default/packages/melange.ppx/tests/mel_send_pipe.t.corrected
# diff --git a/_build/default/packages/melange.ppx/tests/mel_send_pipe.t b/_build/default/packages/melange.ppx/tests/mel_send_pipe.t.corrected
# index c471550..83db895 100644
# --- a/_build/default/packages/melange.ppx/tests/mel_send_pipe.t
# +++ b/_build/default/packages/melange.ppx/tests/mel_send_pipe.t.corrected
# @@ -56,6 +56,7 @@ Make sure is placed correctly
#  Single argument (Ptyp_constr)
#    $ cat > input.ml << EOF
#    > external arrayBuffer : arrayBuffer Js.Promise.t = "arrayBuffer" [@@mel.send.pipe: T.t]
# +  warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
#  
#    $ ./standalone.exe -impl input.ml | ocamlformat - --enable-outside-detected-project --impl | tee output.ml
#    let arrayBuffer : arrayBuffer Js.Promise.t -> T.t =
# @@ -74,6 +75,7 @@ Labelled arguments
#    $ cat > input.ml << EOF
#    > type t
#    > external scale : x:float -> y:float -> unit = "scale"[@@mel.send.pipe : t]
# +  warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
#  
#    $ ./standalone.exe -impl input.ml | ocamlformat - --enable-outside-detected-project --impl | tee output.ml
#    type t
# @@ -100,6 +102,7 @@ Nonlabelled arguments as functions
#    $ cat > input.ml << EOF
#    > type t
#    > external forEach : (string -> int -> unit) -> unit = "forEach" [@@mel.send.pipe : t]
# +  warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
#  
#    $ ./standalone.exe -impl input.ml | ocamlformat - --enable-outside-detected-project --impl | tee output.ml
#    type t
# @@ -125,6 +128,7 @@ Nonlabelled arguments as functions
#  'a
#    $ cat > input.ml << EOF
#    > external postMessage : 'a -> string -> unit = "postMessage" [@@mel.send]
# +  warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
#  
#    $ ./standalone.exe -impl input.ml | ocamlformat - --enable-outside-detected-project --impl | tee output.ml
#    let postMessage : 'a -> string -> unit =
# @@ -149,6 +153,7 @@ Send pipe with 'a
#    $ cat > input.ml << EOF
#    > type t_window
#    > external postMessage : 'a -> string -> unit = "postMessage" [@@mel.send.pipe : t_window]
# +  warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
#  
#    $ ./standalone.exe -impl input.ml | ocamlformat - --enable-outside-detected-project --impl | tee output.ml
#    type t_window

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

melange externals should be marked as browser_only, instead of raising

4 participants