Waypoint
Waypoint copied to clipboard
SplitRender.signal should be a lazy val, not def
Example problem from Discord:
def compPage = compilePage
val splitter = SplitRender[ToolPage, ToolPageComponents](pageSignal)
.collectStatic(CompilePage)(compPage)
div(className := "bottom-grid",
div(Container,
div(ContainerTitle,
h2("Compiler Input"),
child <-- splitter.signal.map(_.submitButton),
),
child <-- splitter.signal.map(_.editor),
),
child <-- splitter.signal.map(_.results),
)
Because splitter.signal is used three times, and it's a def in Waypoint, that creates three new signals, each of which evaluates compPage by-name separately, resulting in three evaluations per pageSignal event instead of one. This breaks the general shared-execution expectation that is core to Airstream.
Fix will be included in the next release.
Workaround for such cases is to save splitter.signal into a val instead of just splitter.