-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Description
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
michalgwo
Metadata
Metadata
Assignees
Labels
No labels