What does status=canceled for a resource mean in Chrome Developer Tools?

前端 未结 30 1973
温柔的废话
温柔的废话 2020-11-22 11:13

What would cause a page to be canceled? I have a screenshot of the Chrome Developer Tools.

\"Canceled

30条回答
  •  独厮守ぢ
    2020-11-22 11:45

    I had the same issue when updating a record. Inside the save() i was prepping the rawdata taken from the form to match the database format (doing a lot of mapping of enums values, etc), and this intermittently cancels the put request. i resolved it by taking out the data prepping from the save() and creating a dedicated dataPrep() method out of it. I turned this dataPrep into async and await all the memory intensive data conversion. I then return the prepped data to the save() method that i could use in the http put client. I made sure i await on dataPrep() before calling the put method:

    await dataToUpdate = await dataPrep(); http.put(apiUrl, dataToUpdate);

    This solved the intermittent cancelling of request.

提交回复
热议问题