zth / rescript-relay

Use Relay with ReScript.
https://rescript-relay-documentation.vercel.app/docs/getting-started
338 stars 53 forks source link

Environment isServer option is missing #352

Closed MoOx closed 2 years ago

MoOx commented 2 years ago

I was following https://reverecre.github.io/relay-nextjs/docs/page-api#getrelayserializedstate and saw an isServer option that seems missing in this bindings.

Am I correct?

MoOx commented 2 years ago

Here is the patch I am currently using

diff --git a/node_modules/rescript-relay/src/RescriptRelay.res b/node_modules/rescript-relay/src/RescriptRelay.res
index 4c3e4e3..90fb10f 100644
--- a/node_modules/rescript-relay/src/RescriptRelay.res
+++ b/node_modules/rescript-relay/src/RescriptRelay.res
@@ -601,6 +601,8 @@ module Environment = {
     missingFieldHandlers: array<MissingFieldHandler.t>,
     @optional
     requiredFieldLogger: RequiredFieldLogger.js,
+    @optional
+    isServer: bool,
   }

   @module("relay-runtime") @new
@@ -613,6 +615,7 @@ module Environment = {
     ~treatMissingFieldsAsNull=?,
     ~missingFieldHandlers=?,
     ~requiredFieldLogger=?,
+    ~isServer=?,
     (),
   ) =>
     make(
@@ -626,6 +629,7 @@ module Environment = {
         | None => [nodeInterfaceMissingFieldHandler]
         },
         ~requiredFieldLogger=?requiredFieldLogger->Belt.Option.map(RequiredFieldLogger.toJs),
+        ~isServer?,
         (),
       ),
     )
diff --git a/node_modules/rescript-relay/src/RescriptRelay.resi b/node_modules/rescript-relay/src/RescriptRelay.resi
index 9db7790..4d9f0d7 100644
--- a/node_modules/rescript-relay/src/RescriptRelay.resi
+++ b/node_modules/rescript-relay/src/RescriptRelay.resi
@@ -810,6 +810,7 @@ module Environment: {
     ~treatMissingFieldsAsNull: bool=?,
     ~missingFieldHandlers: array<MissingFieldHandler.t>=?,
     ~requiredFieldLogger: RequiredFieldLogger.t=?,
+    ~isServer: bool=?,
     unit,
   ) => t