File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
workflow-core/src/commonMain/kotlin/com/squareup/workflow1 Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -787,11 +787,20 @@ public abstract class StatefulWorkflow<
787787 ): StateT = initialState(props, snapshot)
788788
789789 /* *
790- * Called from [RenderContext.renderChild] instead of [initialState] when the workflow is already
791- * running. This allows the workflow to detect changes in props, and possibly change its state in
792- * response. This method is called only if the new props value is not `==` with the old.
790+ * Called immediately before [render] if the parent workflow has provided updated
791+ * [PropsT] that are not `==` to those provided previously. This allows the child
792+ * to update its state based on the new information before rendering.
793+ *
794+ * Note, though, that it is generally a mistake to copy information from [PropsT]
795+ * to [StateT]! [PropsT] is always available via the `renderProps` parameter
796+ * of [render], and as [props][WorkflowAction.Updater.props] for a [WorkflowAction].
797+ * This method is mainly useful if you need to switch an `enum` or `sealed` [StateT]
798+ * based on [PropsT].
793799 *
794800 * Default implementation does nothing.
801+ *
802+ * @return the new [StateT]. [render] is then called immediately with this
803+ * value as `renderProps`.
795804 */
796805 public open fun onPropsChanged (
797806 old : PropsT ,
You can’t perform that action at this time.
0 commit comments