Message from JavaScript discussions

March 2019

— Hi


Hey everyone, I have a query. I just read about the promises and the ways they are used (along with cancelling a promise). But I didn't find any need of cancelling a promise, and suppose if I am performing an api request using the fetch method (as the method returns a promise). If I cancel the promise what will happen to the api request ? will it be ignored ?

— No, it will not be ignored

— It might still complete

— It just won't run the code that is potentially waiting for it to complete

— Ty, I will

— So the api request will be ignored right ?

— Ignored by whom?

— The API server? No
Your code? Possibly

— I mean if I trigger a fetch method and cancelled the promise (before receiving the response), will be method still wait for the response ?

Message permanent page

— No, it won't

— But the response might still arrive to your machine, it just won't be handled by anything