React updates components asynchronously

an item of react, the function of deleting a photo. After clicking to delete a photo, you need to update the component and get the value of the list again. The two function body requests carry different id, and the request is an asynchronous function. If you launch a second request according to the returned value, the id value is different, ask the bosses, this is the function of deleting photos
handleDelete = id = > {

const { dispatch } = this.props;
dispatch({
  type: "slot/delPhoto",
  id,
});
//this.forceUpdate(); 
setTimeout(this.loadData(),2000) 

};

this is the function to get the list
loadData () {

const { dispatch, match: { params: { id } } } = this.props;
dispatch({
  type: "slot/fetchAudit",
  id,
});
//this.forceUpdate();

}
I want to force the update of the component through this.forceUpdate (), but it doesn"t work. Here are two functions of the request:
* delPhoto ({id}, {call, put}) {

  const response = yield call(delPhoto, id);
  if (response.status === true) {
    message.success("");
  } else {
    message.error("");
  }
},

* fetchAudit ({id}, {call, put}) {

  const response = yield call(getAuditSlot, id);
  if (response.status === true) {
    yield put({
      type: "queryAudit",
      payload: response.data,
    });
  }
},

dva




May.21,2022

first of all, there is a problem with the timing of getting the list, and you should not get it until the deletion is successful. And the two id you requested are not supposed to be the same id, are they? One is the id of the deleted image, and the other is not clear what it is, but you should not request a list based on the deleted image id. Finally, the fact that the react component is not updated should only be due to no change in the received props or internal state, or because the shouldComponentUpdate returns false. Can you check whether there is any difference in the list data obtained before and after deletion?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b226e7-2b60d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b226e7-2b60d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?