The data source mappedExercise
of your SetList
looks suspicious, you are assigning a new random id for the set item in each render, which may cause the old SetList
Item to be demounted after updating the data store.
//... ExerciseItem
const mappedExercise = {
...exercise,
sets: exercise.sets.map(set => ({
...set,
id: uuid.v4() // this id should be consistent in renders
}))
};
By the way, the mapping seems to be redundant here as you have already assigned a unique id in adding sets. Maybe you can keep the id by use exercise.sets
directly?