Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Support React Refresh #1069

Draft
wants to merge 73 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
419509d
Add `testEmissions` module with ReactRefresh JS test
japgolly Jun 1, 2022
67f0713
Add EmissionTest
japgolly Jun 1, 2022
7d5f589
Merge branch 'master' into topic/refreshReact
japgolly Jun 1, 2022
f0e130f
Update emissions for SJS 1.10
japgolly Jun 1, 2022
9f484dc
Separate emission expectations by Scala version
japgolly Jun 1, 2022
3d057f8
Emissions output: replace unicode "_", add trailing line
japgolly Jun 1, 2022
5796d2e
Tweak EmissionTest conditions to showResult
japgolly Jun 2, 2022
1717979
Finally get working macros in place for a render hook method
japgolly Jun 2, 2022
89ee1f2
Remove useless line
japgolly Jun 6, 2022
8197dd3
Checkpoint: UseState on Scala 2
japgolly Jun 6, 2022
d3b8a09
HookDefn propsType not needed
japgolly Jun 6, 2022
39ce3dc
Handle `useStateBy` and `withPropsChildren`
japgolly Jun 6, 2022
bee7150
Fix formatting
japgolly Jun 6, 2022
ff104a4
Add TODO
japgolly Jun 6, 2022
008744e
Remove NoHooksWithChildren for now
japgolly Jun 6, 2022
d2e6f64
Fix and harden ReactRefreshTest
japgolly Jun 6, 2022
656a963
Rewrite `useStateWithReuse{,By}`
japgolly Jun 6, 2022
cfb090c
Create AbstractHookMacros
japgolly Jun 7, 2022
2005e88
Add `tcc` sbt alias
japgolly Jun 8, 2022
9967f39
Prepare `AbstractHookMacros` for Scala 3
japgolly Jun 8, 2022
1dda343
Let's try an external `HookRewriterCtx`
japgolly Jun 8, 2022
b9ccc8b
Refactor `HookRewriter` so that `ValDef` creation is atomic
japgolly Jun 9, 2022
d763377
Rename `tec` alias
japgolly Jun 9, 2022
c69eaf1
Further prep for Scala 3 support
japgolly Jun 9, 2022
e3c8da8
Scala 3 rewriting acting like its working
japgolly Jun 9, 2022
3bc3af9
Silence macrotasks warnings in downstream-tests
japgolly Jun 9, 2022
9425f16
Make SNAPSHOT versions stable
japgolly Jun 9, 2022
fd38f4b
Give up trying to preserve bincompat
japgolly Jun 10, 2022
11f0cf5
Revert "Give up trying to preserve bincompat"
japgolly Jun 10, 2022
02b1f18
Recover bincompat, turns out there was a node version issue
japgolly Jun 10, 2022
76790d5
Generate test emissions with less SJS safety
japgolly Jun 10, 2022
48f92cf
Make emission testing output more useful for debugging
japgolly Jun 10, 2022
84d6666
Add `renderDebug`
japgolly Jun 10, 2022
386f6a7
Turn rewrite failures into compiler warnings
japgolly Jun 10, 2022
13b9041
Support function refs in rewrite args
japgolly Jun 10, 2022
f0f87f9
Validate react-refresh version
japgolly Jun 13, 2022
3a75383
Upgrade to react-refresh 0.13.0
japgolly Jun 13, 2022
065ddb3
Support `custom*` hook methods
japgolly Jun 13, 2022
2f1851c
Properly handle intermediary hooks with Unit results
japgolly Jun 14, 2022
b28aac6
Refactor and improve readability of new hook macro code
japgolly Jun 14, 2022
725a7fd
Improve ReactRefreshTest
japgolly Jun 14, 2022
1128fc4
Add emission tests for custom hooks
japgolly Jun 14, 2022
7275c97
Upgrade react-refresh to 0.14.0 (identical to 0.13.0 anyway)
japgolly Jun 16, 2022
1a13dfe
Oh no, custom hooks need rewriting too
japgolly Jun 16, 2022
931a8d3
Gonna have to add `renderRR` and leave `render` alone
japgolly Jun 16, 2022
cbdd990
Test hook components with `.render` and with `.renderRR`
japgolly Jun 16, 2022
19a50aa
Reorder methods in HookMacros
japgolly Jun 16, 2022
073ee30
Refactor: rename secondary render macro methods
japgolly Jun 16, 2022
faac76e
Fix rewriting of custom hooks with local vals in Scala 3
japgolly Jun 16, 2022
6f16bcb
Make `Hook{Defn,Step}` static
japgolly Jun 16, 2022
729ef6d
Support RR on the hooks primary API
japgolly Jun 17, 2022
70cde24
Refactor for readability
japgolly Jun 17, 2022
d0e4ea6
Support and test, all variations of hook component creation with RR
japgolly Jun 17, 2022
c07533a
Support rewriting of `local*` and `unchecked*` hooks
japgolly Jun 20, 2022
de5e001
Tiny tweak - too tired to actually describe
japgolly Jun 20, 2022
f2c63de
Inline `HookCtx` stuff
japgolly Jun 20, 2022
63a2045
Got `useCallback` working
japgolly Jun 21, 2022
8298460
Rename last context object to `render_ctx`
japgolly Jun 21, 2022
55723b7
Support `useCallbackWithDeps*`
japgolly Jun 21, 2022
6d66364
`useMemo*` done
japgolly Jun 22, 2022
142f6e1
`use{Context,DebugValue,Reducer}` done
japgolly Jun 22, 2022
2fb130a
Avoid shadowing in Scala 2
japgolly Jun 22, 2022
e868482
Consolidate some RR tests; test time is starting to get annoying
japgolly Jun 22, 2022
5c17b04
`use*Effect*`
japgolly Jun 23, 2022
63c5df6
`useForceUpdate` take 2
japgolly Jun 23, 2022
a8693f4
Support `useRef*`
japgolly Jun 24, 2022
df81d84
Remove obsolete emission test output
japgolly Jun 27, 2022
17f5b09
Upgrade Scala.js and re-gen all emissions
japgolly Jun 27, 2022
fc559e0
Support render with reuse with children
japgolly Jun 27, 2022
c4cf1b3
Fix Scala 2 compilation - stategy is fine
japgolly Jun 27, 2022
ebfd757
Re-generate all test emissions with Scala.js 1.10.1
japgolly Jun 28, 2022
ad7b116
Add placeholder implementations for renderRR with reuse
japgolly Jun 27, 2022
3a428e3
Support RR in `render{Reusable,WithReuse,WithReuseBy}`
japgolly Jun 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/ci
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ echo
rm -rf */target/scala-*/{,test-}classes
cmd=(
sbt
-DCI=1
-J-Xmx3G
-J-XX:+UseG1GC
++$SCALA_VER
Expand Down
28 changes: 17 additions & 11 deletions library/aliases.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
addCommandAlias("CB", "project coreBundleCallback")
addCommandAlias("CE", "project coreBundleCatsEffect")
addCommandAlias("CG", "project coreGeneric")
addCommandAlias("E", "project extra")
addCommandAlias("FM", "project facadeMain")
addCommandAlias("FT", "project facadeTest")
addCommandAlias("GH", "project ghpages")
addCommandAlias("M2", "project extraExtMonocle2")
addCommandAlias("M3", "project extraExtMonocle3")
addCommandAlias("TS", "project tests")
addCommandAlias("TU", "project testUtil")
addCommandAlias("CB", "project coreBundleCallback")
addCommandAlias("CE", "project coreBundleCatsEffect")
addCommandAlias("CG", "project coreGeneric")
addCommandAlias("E", "project extra")
addCommandAlias("FM", "project facadeMain")
addCommandAlias("FT", "project facadeTest")
addCommandAlias("GH", "project ghpages")
addCommandAlias("M2", "project extraExtMonocle2")
addCommandAlias("M3", "project extraExtMonocle3")
addCommandAlias("TE", "project testEmissions")
addCommandAlias("TEJ", "project testEmissionsJS")
addCommandAlias("TT", "project tests")
addCommandAlias("TU", "project testUtil")

addCommandAlias("tt", "tests/test")
addCommandAlias("te", "testEmissions/test")
addCommandAlias("cte", "testEmissionsJS/clean;testEmissions/test")
4 changes: 3 additions & 1 deletion library/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ val ghpages = ScalaJsReact.ghpages
val ghpagesMacros = ScalaJsReact.ghpagesMacros
val root = ScalaJsReact.root
val scalafixRules = ScalaJsReact.scalafixRules
val testEmissions = ScalaJsReact.testEmissions
val testEmissionsJS = ScalaJsReact.testEmissionsJS
val tests = ScalaJsReact.tests
val testUtilMacros = ScalaJsReact.testUtilMacros
val testUtil = ScalaJsReact.testUtil
val testUtilMacros = ScalaJsReact.testUtilMacros
val util = ScalaJsReact.util
val utilCatsEffect = ScalaJsReact.utilCatsEffect
val utilDummyDefaults = ScalaJsReact.utilDummyDefaults
Expand Down
57 changes: 54 additions & 3 deletions library/project/Build.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sbt._
import sbt.Keys._
import org.scalajs.jsdependencies.sbtplugin.JSDependenciesPlugin.autoImport._
import org.scalajs.linker.interface.{ModuleInitializer, ModuleSplitStyle}
import org.scalajs.sbtplugin.ScalaJSPlugin
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import scalafix.sbt.BuildInfo.{scalafixVersion => ScalafixVer}
Expand Down Expand Up @@ -35,20 +36,25 @@ object ScalaJsReact {
ghpages,
ghpagesMacros,
scalafixRules,
testEmissions,
testEmissionsJS,
tests,
testUtilMacros,
testUtil,
testUtilMacros,
util,
utilCatsEffect,
utilDummyDefaults,
utilFallbacks,
)

def commonSettings: PE =
_.enablePlugins(ScalaJSPlugin, ScalafixPlugin)
def commonSettingsCross: PE =
_.enablePlugins(ScalafixPlugin)
.dependsOn(scalafixRules % ScalafixConfig)
.configure(commonSettingsWithoutPlugins)

def commonSettings: PE =
_.enablePlugins(ScalaJSPlugin).configure(commonSettingsCross)

def shimDummyDefaults: PE =
_.dependsOn(utilDummyDefaults % Provided)

Expand Down Expand Up @@ -209,6 +215,51 @@ object ScalaJsReact {
)
.configure(conditionallyDisable) // keep this last

lazy val testEmissions = project
.in(file("testEmissions/jvm"))
.configure(commonSettingsCross, preventPublication, utestSettingsCross)
.settings(
libraryDependencies += Dep.microlibsUtils.value,
Test / fork := true,
Test / javaOptions ++= {
val jsOutputDir = (testEmissionsJS / Compile / fastLinkJS / scalaJSLinkerOutputDirectory).value
val scalaVer = scalaVersion.value
val tempDir = (Test / classDirectory).value
val testResDir = (Test / resourceDirectory).value
val testRootDir = (Test / sourceDirectory).value
Seq(
s"-DCI=${if (inCI) "1" else "0"}",
s"-DjsOutputDir=${jsOutputDir.absolutePath}",
s"-DscalaVer=$scalaVer",
s"-DtempDir=${tempDir.absolutePath}",
s"-DtestResDir=${testResDir.absolutePath}",
s"-DtestRootDir=${testRootDir.absolutePath}",
)
},
Test / test := (Test / test ).dependsOn(testEmissionsJS / Compile / fastLinkJS).value,
Test / testOnly := (Test / testOnly).dependsOn(testEmissionsJS / Compile / fastLinkJS).evaluated,
)

lazy val testEmissionsJS = project
.in(file("testEmissions/js"))
.configure(commonSettings, preventPublication, hasNoTests)
.dependsOn(coreBundleCallback)
.settings(
Compile / scalaJSLinkerConfig ~= { _
.withModuleKind(ModuleKind.ESModule)
.withModuleSplitStyle(ModuleSplitStyle.SmallestModules)
.withSourceMap(false)
// .withESFeatures(_.withESVersion(ESVersion.ES2021))
// .withSemantics(_
// .withArrayIndexOutOfBounds(CheckedBehavior.Unchecked)
// .withAsInstanceOfs(CheckedBehavior.Unchecked)
// .withProductionMode(true)
// )
},
Compile / scalaJSModuleInitializers +=
ModuleInitializer.mainMethod("japgolly.scalajs.react.test.emissions.Main", "main")
)

lazy val tests = project
.dependsOn(testUtil, coreExtCatsEffect, extraExtMonocle3)
.dependsOn(coreBundleCallback) // Low priority
Expand Down
1 change: 1 addition & 0 deletions library/project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ object Dependencies {
val microlibsCompileTime = Def.setting("com.github.japgolly.microlibs" %%% "compile-time" % Ver.microlibs)
val microlibsTestUtil = Def.setting("com.github.japgolly.microlibs" %%% "test-util" % Ver.microlibs)
val microlibsTypes = Def.setting("com.github.japgolly.microlibs" %%% "types" % Ver.microlibs)
val microlibsUtils = Def.setting("com.github.japgolly.microlibs" %%% "utils" % Ver.microlibs)
japgolly marked this conversation as resolved.
Show resolved Hide resolved
val monocle2 = Def.setting("com.github.julien-truffaut" %%% "monocle-core" % Ver.monocle2 cross CrossVersion.for3Use2_13 excludeAll(ExclusionRule(organization = "org.typelevel")))
val monocle3 = Def.setting("dev.optics" %%% "monocle-core" % Ver.monocle3)
val nyayaGen = Def.setting("com.github.japgolly.nyaya" %%% "nyaya-gen" % Ver.nyaya)
Expand Down
26 changes: 21 additions & 5 deletions library/project/Lib.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ object Lib {

val ghProject = "scalajs-react"

private def readConfigVar(name: String): String =
Option(System.getProperty(name)).orElse(Option(System.getenv(name)))
.fold("")(_.trim.toLowerCase)

val inCI = readConfigVar("CI") == "1"

def scalacCommonFlags: Seq[String] = Seq(
"-deprecation",
"-feature",
Expand Down Expand Up @@ -113,14 +119,24 @@ object Lib {
def preventPublication: PE =
_.settings(publish / skip := true)

def utestSettingsCross(scope: Configuration): PE =
_.settings(
scope / scalacOptions ++= {
val isScala2 = scalaVersion.value.startsWith("2")
if (isScala2) Seq("-Wconf:msg=copyArrayToImmutableIndexedSeq:s") else Seq()
},
libraryDependencies += Dep.utest.value % scope,
libraryDependencies += Dep.microlibsTestUtil.value % scope,
testFrameworks += new TestFramework("utest.runner.Framework"))

def utestSettingsCross: PE =
utestSettingsCross(Test)

def utestSettings(scope: Configuration): PE =
_.configure(InBrowserTesting.js)
_.configure(InBrowserTesting.js, utestSettingsCross(scope))
.settings(
jsEnv := new JSDOMNodeJSEnv,
Test / scalacOptions += "-language:reflectiveCalls",
libraryDependencies += Dep.utest.value % scope,
libraryDependencies += Dep.microlibsTestUtil.value % scope,
testFrameworks += new TestFramework("utest.runner.Framework"))
Test / scalacOptions += "-language:reflectiveCalls")

def utestSettings: PE =
utestSettings(Test)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package japgolly.scalajs.react.test.emissions

import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.html_<^._
import org.scalajs.dom

object Main {

def main(): Unit = {
val app = Component()
val cont = dom.document.getElementById("root")
app.renderIntoDOM(cont)
}

private val Component = ScalaFnComponent[Unit] { _ =>
<.div(
UseState.Component(),
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package japgolly.scalajs.react.test.emissions

import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.html_<^._

object UseState {

val Component = ScalaFnComponent.withHooks[Unit]
.useState(123)
.render { (_, s) =>
<.button(
"Count is ", s.value,
^.onClick --> s.modState(_ + 1),
)
}
}
1 change: 1 addition & 0 deletions library/testEmissions/jvm/src/test/node/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 6 additions & 0 deletions library/testEmissions/jvm/src/test/node/babel.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [],
"plugins": [
"react-refresh/cjs/react-refresh-babel.development"
]
}
5 changes: 5 additions & 0 deletions library/testEmissions/jvm/src/test/node/babel.norm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"comments": false,
"presets": [],
"plugins": []
}
10 changes: 10 additions & 0 deletions library/testEmissions/jvm/src/test/node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "scalajs_react_testing",
"version": "1.0.0",
"private": true,
"dependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.17.5",
"react-refresh": "^0.11.0"
}
}
16 changes: 16 additions & 0 deletions library/testEmissions/jvm/src/test/resources/rr-js/demo-in.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { useState, useEffect } from 'react'

function App() {
const [count, setCount] = useState(0)

useEffect(() => {
document.title = `You clicked ${count} times`;
});

return React.createElement("button", {
type: "button",
onClick: () => setCount(count => count + 1)
}, "count is: ", count);
}

export default App
25 changes: 25 additions & 0 deletions library/testEmissions/jvm/src/test/resources/rr-js/demo-out.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var _s = $RefreshSig$();

import React, { useState, useEffect } from 'react';

function App() {
_s();

const [count, setCount] = useState(0);
useEffect(() => {
document.title = `You clicked ${count} times`;
});
return React.createElement("button", {
type: "button",
onClick: () => setCount(count => count + 1)
}, "count is: ", count);
}

_s(App, "/xL7qdScToREtqzbt5GZ1kHtYjQ=");

_c = App;
export default App;

var _c;

$RefreshReg$(_c, "App");
37 changes: 37 additions & 0 deletions library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
function $c_Lsjr_test_emissions_UseState$() {
this.Lsjr_test_emissions_UseState$__f_Component = null;
$n_Lsjr_test_emissions_UseState$ = this;
$j_sjr_package$.$m_Lsjr_package$();
var this$4 = $j_sjr_hooks_HookComponentBuilder$.$m_Lsjr_hooks_HookComponentBuilder$().apply__Lsjr_hooks_HookComponentBuilder$ComponentP$First();
var initialState = new $j_AnonFunction0.$c_sjsr_AnonFunction0(() => 123);
var step = new $j_sjr_hooks_HookComponentBuilder$ComponentP$FirstStep.$c_Lsjr_hooks_HookComponentBuilder$ComponentP$FirstStep();
var this$18 = $j_sjr_hooks_Api$SecondaryWithRender.$as_Lsjr_hooks_Api$SecondaryWithRender($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$4, initialState, step));
var f = new $j_AnonFunction2.$c_sjsr_AnonFunction2((x$1$2, s$2) => {
$j_java_lang_Object.$as_jl_Void(x$1$2);
var s = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s$2);
var $$x2 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$();
$j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$();
$j_sjr_vdom_Exports$.$m_Lsjr_vdom_Exports$();
$j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$();
$j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$();
var $$x1 = new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1("Count is ");
$j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$();
var v = $j_java_lang_Object.$uI(s.Lsjr_hooks_Hooks$UseStateF$$anon$2__f_raw[0]);
$j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$();
var array = [$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$1 => () => {
$j_sjr_Reusable$.$m_Lsjr_Reusable$();
var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$1);
return new $j_sjr_callback_CallbackTo.$c_Lsjr_callback_CallbackTo($j_sjr_callback_CallbackTo.$as_Lsjr_callback_CallbackTo($j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1(x$2$2 => {
var x$2 = $j_java_lang_Object.$uI(x$2$2);
return 1 + x$2 | 0;
}))).Lsjr_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline);
})(s)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)];
return $$x2.apply$extension__T__sci_Seq__Lsjr_vdom_TagOf("button", new $j_WrappedVarArgs.$c_sjsr_WrappedVarArgs(array));
});
var this$17 = $j_sjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$.$m_Lsjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$();
var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(this$17);
var s$3 = $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit);
this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_Api$SecondaryWithRender.$f_Lsjr_hooks_Api$SecondaryWithRender__render__O__Lsjr_hooks_Api$SubsequentStep__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(this$18, f, step$1, s$3);
}

export { $c_Lsjr_test_emissions_UseState$ };
40 changes: 40 additions & 0 deletions library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
function $c_Lsjr_test_emissions_UseState$() {
this.Lsjr_test_emissions_UseState$__f_Component = null;
$n_Lsjr_test_emissions_UseState$ = this;
$j_sjr_package$.$m_Lsjr_package$();
var this$4 = $j_sjr_hooks_HookComponentBuilder$.$m_Lsjr_hooks_HookComponentBuilder$().apply__Lsjr_hooks_HookComponentBuilder$ComponentP$First();
var initialState = new $j_AnonFunction0.$c_sjsr_AnonFunction0(() => 123);
var step = new $j_sjr_hooks_HookComponentBuilder$ComponentP$FirstStep.$c_Lsjr_hooks_HookComponentBuilder$ComponentP$FirstStep();
var this$16 = $j_sjr_hooks_Api$SecondaryWithRender.$as_Lsjr_hooks_Api$SecondaryWithRender($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$4, initialState, step));
var f = new $j_AnonFunction2.$c_sjsr_AnonFunction2((_$1, s) => {
$j_java_lang_Object.$as_jl_Void(_$1);
var s$1 = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s);
var this$14 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$();
$j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$();
$j_sjr_vdom_Exports$.$m_Lsjr_vdom_Exports$();
var self = "button";
var $$x2 = $j_java_lang_Character$.$m_sr_ScalaRunTime$();
$j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$();
$j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$();
var $$x1 = new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1("Count is ");
$j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$();
var v = $j_java_lang_Object.$uI(s$1.Lsjr_hooks_Hooks$$anon$2__f_raw[0]);
$j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$();
var xs = $$x2.wrapRefArray__AO__sci_ArraySeq(new ($j_sjr_vdom_TagMod.$d_Lsjr_vdom_TagMod.getArrayOf().constr)([$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$2 => () => {
$j_sjr_Reusable$.$m_Lsjr_Reusable$();
var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$2);
var ev$1 = $j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1(_$2 => {
var _$2$1 = $j_java_lang_Object.$uI(_$2);

return 1 + _$2$1 | 0;
}));
return new $j_sjr_callback_CallbackTo.$c_Lsjr_callback_CallbackTo(ev$1 === null ? null : $j_sjr_callback_CallbackTo.$as_Lsjr_callback_CallbackTo(ev$1).Lsjr_callback_CallbackTo__f_trampoline);
})(s$1)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)]));
return $j_sjr_vdom_TagLite.$f_Lsjr_vdom_TagLite__apply__T__sci_Seq__Lsjr_vdom_TagOf(this$14, self, xs);
});
var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1();
var s$3 = $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit);
this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_Api$SecondaryWithRender.$f_Lsjr_hooks_Api$SecondaryWithRender__render__O__Lsjr_hooks_Api$SubsequentStep__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(this$16, f, step$1, s$3);
}

export { $c_Lsjr_test_emissions_UseState$ };
Loading