Inside this state, the values of onDragStarted and onDragStopped are passed downwards to a DisposableEffect. But that effect doesn't properly apply rememberUpdatedState and captures outdated versions of these lambdas in its block. As a result, the sortableList variable and all other captured variables in composition which are passed to the store in the code below are not correct.
modifier = Modifier.draggableHandle(
enabled = state.sortingModeEnabled,
onDragStarted = {
haptics.performHapticFeedback(HapticFeedbackType.GestureThresholdActivate)
},
onDragStopped = {
intent(FinishedReordering(sortableList))
haptics.performHapticFeedback(HapticFeedbackType.GestureEnd)
}
)
To fix this, properly call rememberUpdatedState on all variable references that are captured into/ passed outside the composition
Inside this state, the values of onDragStarted and onDragStopped are passed downwards to a
DisposableEffect. But that effect doesn't properly applyrememberUpdatedStateand captures outdated versions of these lambdas in itsblock. As a result, thesortableListvariable and all other captured variables in composition which are passed to the store in the code below are not correct.To fix this, properly call
rememberUpdatedStateon all variable references that are captured into/ passed outside the composition