see that many people misunderstand that it has been sent 10 times at a time, which is added like this:
if the user can click the button continuously and send a request one time at a time, a li, will be generated after each response result. Because of the influence of the network status, the request sent out may respond first. If you click 10 times, how to ensure that the order of the 10 li is the same as the order of the request?
the answer to using Promise.all is definitely wrong, because you can"t predict when the user clicks the button. The user may complete 10 clicks in a second or two, but it may also be done in 10 seconds. It certainly can"t be said that I wait for users to click 10 times before using Promise.all requests, not to mention that the actual situation is not necessarily 10 times.
this is the only question that I didn"t answer very well in an interview, so I was quite impressed. At first, the Promise.all, I also answered was directly negated. Later, I mentioned that I carried the relevant parameters in the request message, returned in the response, and implemented it locally as a mapping relationship, but the interviewer was still not very satisfied. Later, after I asked, the interviewer only mentioned the idea and said a few words. I don"t remember very clearly. After looking up the data, it seems that the request response contains a Request-Id field and uses UUID as the value. I"m not sure if I haven"t practiced it!