square / workflow-swift

A Swift and Kotlin library for making composable state machines, and UIs driven by those state machines.
https://square.github.io/workflow
Apache License 2.0
322 stars 44 forks source link

sending actions during action propagation should likely assert #275

Open jamieQ opened 6 months ago

jamieQ commented 6 months ago

consider the following pattern:

childWorkflow
  .mapOutput { sink.send(.someOutput) }
  .ignoreOutput()
  .rendered(in: context)

this will often 'work', but causes concurrent action handling in the runtime. using sinks during action propagation should likely trigger some form of debug assertion at a minimum, since emitting actions during action handling can lead to unexpected processing/dropped events, or redundant render passes.