Skip to content

Commit f0b1906

Browse files
committed
bugfix: RList.singleton_s: make sure to keep intermediate signal alive.
1 parent fb4eec1 commit f0b1906

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/reactiveData.ml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -347,14 +347,17 @@ module RList = struct
347347
let first = ref true in
348348
let e, send = React.E.create () in
349349
let result = from_event [] e in
350-
let _ =
351-
React.S.map
352-
(fun x ->
353-
if !first then (
354-
first := false;
355-
send (Patch [ I (0, x) ]))
356-
else send (Patch [ U (0, x) ]))
357-
s
350+
let (`R _) =
351+
let s' =
352+
React.S.map
353+
(fun x ->
354+
if !first then (
355+
first := false;
356+
send (Patch [ I (0, x) ]))
357+
else send (Patch [ U (0, x) ]))
358+
s
359+
in
360+
React.E.retain e (fun () -> ignore (React.S.value s'))
358361
in
359362
result
360363

0 commit comments

Comments
 (0)