Skip to content

Commit

Permalink
React fix
Browse files Browse the repository at this point in the history
Now that weak references are properly implemented by Js_of_ocaml, we need
to make sure that signals and events do not get garbage collected too
early.
  • Loading branch information
vouillon committed Oct 6, 2023
1 parent 9bfdc16 commit d839cac
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions template.distillery/demo_notif.eliom
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(* This file was generated by Ocsigen Start.
Feel free to use it, modify it, and redistribute it as you wish. *)
(* Notification demo *)

open Js_of_ocaml_lwt]

(* Service for this demo *)
Expand Down Expand Up @@ -54,12 +53,13 @@ let%server () =
let e : (unit * string) Eliom_react.Down.t = Notif.client_ev () in
ignore
[%client
(ignore
@@ React.E.map
(fun (_, msg) ->
(* Eliom_lib.alert "%s" msg *)
Os_msg.msg ~level:`Msg (Printf.sprintf "%s" msg))
~%e
(Eliom_lib.Dom_reference.retain Js_of_ocaml.Dom_html.window
~keep:
(React.E.map
(fun (_, msg) ->
(* Eliom_lib.alert "%s" msg *)
Os_msg.msg ~level:`Msg (Printf.sprintf "%s" msg))
~%e)
: unit)];
Lwt.return_unit)

Expand Down

0 comments on commit d839cac

Please sign in to comment.