79620696

Date: 2025-05-14 03:44:08
Score: 2
Natty:
Report link

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?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Alpenmilch