You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since version melange.4.0.1-52 all react components are getting curried.
The currying of the components leads to the following warning from eslint:
React Hook React.useEffect has an unnecessary dependency: 'a'. Either exclude it or remove the dependency array. Outer scope values like 'a' aren't valid dependencies because mutating them doesn't re-render the component.
Take for example the following component:
[@react.component]
let make = (~a, ~b) => {
React.useEffect2(
() => {
if (a) {
Js.log(a);
} else {
Js.log(b);
};
None;
},
(a, b),
);
React.null;
};
In version 4.0.0-51, the following JavaScript is generated:
// Generated by Melangeimport*asReactfrom"react";function_none_(Props){vara=Props.a;varb=Props.b;React.useEffect((function(){if(a){console.log(a);}else{console.log(b);}}),[a,b]);returnnull;}varmake=_none_;export{make,}/* react Not a pure module */
In version 4.0.1-52, the following JavaScript is generated:
// Generated by Melangeimport*asReactfrom"react";functionmake(a){returnfunction(b){React.useEffect((function(){if(a){console.log(a);}else{console.log(b);}}),[a,b]);returnnull;};}functionTest(Props){returnmake(Props.a)(Props.b);}constmake$1=Test;export{make$1asmake,}/* react Not a pure module */
The text was updated successfully, but these errors were encountered:
i have a feeling that this isn't something we can solve in melange without ppxlib's help. thankfully, there's work to port ppxlib's AST to the OCaml 5.2 AST, which i think would cause this to get fixed.
FTR i believe this is the underlying change that's causing this issue: ocaml/ocaml#12236
I haven't tested deeply, but while working on the reason-react-ppx last week, I found the generated Pexp_fun problematic here. If it's what I think it is (a not very optimal usage of the pexp_fun in the generation) I'm able to fix this in a future release of reason-react-ppx
Since version
melange.4.0.1-52
all react components are getting curried.The currying of the components leads to the following warning from eslint:
Take for example the following component:
In version 4.0.0-51, the following JavaScript is generated:
In version 4.0.1-52, the following JavaScript is generated:
The text was updated successfully, but these errors were encountered: