When using fastOptJS my code runs GetDerivedStateFromProps just fine
But if I only change from fastOptJS to using fullOptJS, suddenly GetDerivedStateFromProps is never called or does not exist.
To verify there wasn't some webpack config that was somehow compromising my code, I set the following to be exactly the same in both cases (no other setting in my project discriminates by optimization mode):
webpackConfigFile in fastOptJS := Some(resourceDirectory.in(Compile).value / "webpack" / "webpack-fastopt.config.js"),
webpackConfigFile in fullOptJS := Some(resourceDirectory.in(Compile).value / "webpack" / "webpack-fastopt.config.js"),
Looking at fastOptJS javascript, I have GetDerivedStateFromProps javascript functions clearly defined:
getDerivedStateFromProps__LSearch$Props__LSearch$State__LSearch$State = (function(nextProps, prevState) {
var x = ((("DERIVED Called!: " + nextProps.Context$1.criteria$1.b$1.mkString__T__T(",")) + ", ") + prevState.criteria$1.b$1.mkString__T__T(","));
var this$2 = $m_s_Console$();
var this$3 = $as_Ljava_io_PrintStream(this$2.outVar$2.v$1);
this$3.java$lang$JSConsoleBasedPrintStream$$printString__T__V((x + "\n"));
var x$1 = nextProps.Context$1.criteria$1;
var x$2 = prevState.criteria$1;
if ((!((x$1 === null) ? (x$2 === null) : x$1.equals__O__Z(x$2)))) {
var this$5 = $m_s_Console$();
var this$6 = $as_Ljava_io_PrintStream(this$5.outVar$2.v$1);
this$6.java$lang$JSConsoleBasedPrintStream$$printString__T__V("FALSE!\n");
var x$2$2 = nextProps.Context$1.criteria$1;
var x$3 = prevState.as$1;
var x$4 = prevState.b$1;
return new $c_LSearch$State().init___Z__sjs_js_Any__sjs_js_Any__Lsection$Variables(false, x$3, x$4, x$2$2)
} else {
var this$8 = $m_s_Console$();
var this$9 = $as_Ljava_io_PrintStream(this$8.outVar$2.v$1);
this$9.java$lang$JSConsoleBasedPrintStream$$printString__T__V("NO CHANGE\n");
return prevState
}
});
Looking at fullOptJS javascript, these are the only matches in the whole file:
When using fastOptJS my code runs GetDerivedStateFromProps just fine
But if I only change from fastOptJS to using fullOptJS, suddenly GetDerivedStateFromProps is never called or does not exist.
To verify there wasn't some webpack config that was somehow compromising my code, I set the following to be exactly the same in both cases (no other setting in my project discriminates by optimization mode):
Looking at fastOptJS javascript, I have GetDerivedStateFromProps javascript functions clearly defined:
Looking at fullOptJS javascript, these are the only matches in the whole file:
I'm using webpack with relevant dependencies: