- 
                Notifications
    
You must be signed in to change notification settings  - Fork 112
 
Open
Description
This would be just like RenderContext.eventHandler with remember = true / STABLE_EVENT_HANDLERS enabled, but without involving the actionSink at all. Basically a convenience for stable lambdas that don't need to update workflow state / emit output.
The simplest variation follows. Ideally we would provide a bunch of overloads with more param types, like we do for eventHandler et al.
/**
 * A convenience to use Workflow's [remember] to create a stable lambda that will stay the same
 * between render passes.
 *
 * This can be used instead of event handlers if you don't need to read/write state, or emit output.
 */
fun BaseRenderContext<*, *, *>.rememberLambda(
  key: String,
  block: () -> Unit,
): () -> Unit {
  return remember(key) { block }
}Metadata
Metadata
Assignees
Labels
No labels