In Child Table update value is cant able to saving using frm.save()

if (selectedColorRow) {
        selectedColorRow.number += add_number;
         frm.refresh_field('child_table_fieldname');
 } else {
         let newRow = frm.add_child('child_table_fieldname', {
                    number: add_number,
                    name: value,
                });
          frm.refresh_field('child_table_fieldname');
   }
   frm.save();

If an existing row with the required data already exists in the child table, it is updated. Otherwise, a new row is created. However, only the new row is saved, and the document is not updated when modifying an existing row.