rocketraman
06/06/2022, 4:46 PMnoOp
call or wrap the logic in a side job. It seems a bit odd to me that if my input handler does this:
doSomething()
setState { ... }
its ok. But if my input handler just does:
doSomething()
then I have to either do
doSomething()
noOp()
or
sideJob { doSomething() }
Am I missing something about how the API is supposed to work and/or about the safety of calling doSomething()
?Casey Brooks
06/06/2022, 5:01 PMnoOp()
is there more to help when first writing your Contract, to be able to send the Input and build the corresponding UI without necessarily implementing it in the InputHandler just yet. Another use-case for it is more complex handling that may have several branches of code updating state, posting events, etc. but one particular branch ignoring the Input for some reason. You would mark that branch as noOp()
to signify that you intend for nothing to happen there.
For this example, it sounds like putting that doSomething()
into a sideJob
would be the way to go. Since you don’t need to update the State or send an Event as the result of doSomething()
, it shouldn’t need to be executed immediately and sideJob
is that kind of “managed” fire-and-forget mechanism