Closed ahaverty closed 7 years ago
This is actually expected behavior and exactly how Promise
s work. resolve()
and reject()
are just callback methods and calling them does not stop execution. You can solve this by either using the if / else
blocks you mentioned or just doing return reject();
instead of just reject()
. The return
will ensure no code after it will be run:
if(!myVar){
return reject();
}
console.log("my var exists if you got this far");
I've noticed calling reject() doesn't end the worker/queue instantly. For example:
Having read and re-read the firebase-queue guide, this wasn't obvious to me. I've gotten around it by not relying on reject()
obvious example:
Perhaps this was never the intention of reject(). But it may be useful to add or highlight this in the guide?
Currently on the following, if relevant: