@@ -2,15 +2,19 @@ package com.squareup.workflow1.internal.compose
22
33import  androidx.compose.runtime.Composable 
44import  androidx.compose.runtime.DisposableEffect 
5+ import  androidx.compose.runtime.NonRestartableComposable 
6+ import  androidx.compose.runtime.ReadOnlyComposable 
57import  androidx.compose.runtime.collection.MutableVector 
68import  androidx.compose.runtime.currentRecomposeScope 
79import  androidx.compose.runtime.getValue 
810import  androidx.compose.runtime.key 
11+ import  androidx.compose.runtime.mutableStateOf 
912import  androidx.compose.runtime.remember 
1013import  androidx.compose.runtime.rememberCoroutineScope 
1114import  androidx.compose.runtime.rememberUpdatedState 
1215import  androidx.compose.runtime.saveable.LocalSaveableStateRegistry 
1316import  androidx.compose.runtime.saveable.SaveableStateRegistry 
17+ import  androidx.compose.runtime.setValue 
1418import  com.squareup.workflow1.ActionApplied 
1519import  com.squareup.workflow1.ActionProcessingResult 
1620import  com.squareup.workflow1.NoopWorkflowInterceptor 
@@ -29,8 +33,8 @@ import com.squareup.workflow1.compose.WorkflowComposableRenderer
2933import  com.squareup.workflow1.identifier 
3034import  com.squareup.workflow1.internal.IdCounter 
3135import  com.squareup.workflow1.internal.WorkflowNodeId 
32- import  com.squareup.workflow1.internal.requireSend 
3336import  com.squareup.workflow1.internal.createId 
37+ import  com.squareup.workflow1.internal.requireSend 
3438import  com.squareup.workflow1.workflowSessionToString 
3539import  kotlinx.coroutines.CoroutineName 
3640import  kotlinx.coroutines.CoroutineScope 
@@ -96,6 +100,8 @@ internal class ComposeWorkflowChildNode<PropsT, OutputT, RenderingT>(
96100    }
97101  }
98102
103+   private  var  lastProps by mutableStateOf(initialProps)
104+ 
99105  /* *
100106   * Function invoked when [onNextAction] receives an output from [outputsChannel]. 
101107   */  
@@ -149,6 +155,9 @@ internal class ComposeWorkflowChildNode<PropsT, OutputT, RenderingT>(
149155    //  inside a renderChild call and renderChild does the keying.
150156    log(" rendering workflow: props=$props " 
151157    workflow as  ComposeWorkflow 
158+ 
159+     notifyInterceptorWhenPropsChanged(props)
160+ 
152161    return  withCompositionLocals(
153162      LocalSaveableStateRegistry  provides saveableStateRegistry,
154163      LocalWorkflowComposableRenderer  provides this 
@@ -167,6 +176,22 @@ internal class ComposeWorkflowChildNode<PropsT, OutputT, RenderingT>(
167176    }
168177  }
169178
179+   @ReadOnlyComposable
180+   @NonRestartableComposable
181+   @Composable
182+   private  fun  notifyInterceptorWhenPropsChanged (newProps :  PropsT ) {
183+     if  (lastProps !=  newProps) {
184+       interceptor.onPropsChanged(
185+         old =  lastProps,
186+         new =  newProps,
187+         state =  ComposeWorkflowState ,
188+         session =  this ,
189+         proceed =  { _, _, _ ->  ComposeWorkflowState  },
190+       )
191+       lastProps =  newProps
192+     }
193+   }
194+ 
170195  @Composable
171196  override  fun  <ChildPropsT , ChildOutputT , ChildRenderingT > renderChild (
172197    childWorkflow :  Workflow <ChildPropsT , ChildOutputT , ChildRenderingT >,
0 commit comments