Skip to content

Commit 68f690d

Browse files
committed
feat: change serialize for to_chunk
1 parent e3adf79 commit 68f690d

File tree

4 files changed

+182
-175
lines changed

4 files changed

+182
-175
lines changed

demo/server/DreamRSC.re

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
let debug = Sys.getenv_opt("DEMO_ENV") === Some("development");
1+
let env =
2+
switch (Sys.getenv_opt("DEMO_ENV")) {
3+
| Some("development") => `Dev
4+
| _ => `Prod
5+
};
26

37
let handleFormRequest = (actionId, formData) => {
48
let formData = {
@@ -99,10 +103,9 @@ let stream_model = (~location, app) =>
99103
stream => {
100104
let%lwt () =
101105
ReactServerDOM.render_model(
102-
~debug,
103106
~subscribe=
104107
chunk => {
105-
if (debug) {
108+
if (env == `Dev) {
106109
Dream.log("Chunk");
107110
Dream.log("%s", chunk);
108111
};
@@ -133,15 +136,15 @@ let stream_html =
133136
~bootstrapScriptContent?,
134137
~bootstrapScripts,
135138
~bootstrapModules,
136-
~debug,
139+
~env,
137140
app,
138141
);
139142

140143
let%lwt () = Dream.write(stream, html);
141144
let%lwt () = Dream.flush(stream);
142145
let%lwt () =
143146
subscribe(chunk => {
144-
if (debug) {
147+
if (env == `Dev) {
145148
Dream.log("Chunk");
146149
Dream.log("%s", chunk);
147150
};

0 commit comments

Comments
 (0)