Closed multimeric closed 2 years ago
Ah this is something my tests managed not to cover, somehow. I'll fix tonight
Thanks, that would be great!
Fixed as of scryfall-sdk@3.2.0
You might want to use v3.2.1 instead that I just pushed, I think it's slightly closer to what I'd originally intended. Technically the tests passed for both but there may be an edge case that this should cover.
Thanks! That definitely seems to fix it.
I believe I've identified a bug. If you use
await Scry.Cards.search(some_query).cancelAfterPage().waitForAll();
, the promise never resolves so the function hangs forever. This is becausewaitForAll
only resolves onend
: https://github.com/ChiriVulpes/scryfall-sdk/blob/b30b9defba7342229fee39a3458e2aec82dbe7d6/src/util/MagicEmitter.ts#L74-L83However if the emitter gets cancelled due to
cancelAfterPage()
, we skip emittingend
, even though the query has successfully completed: https://github.com/ChiriVulpes/scryfall-sdk/blob/b30b9defba7342229fee39a3458e2aec82dbe7d6/src/api/Cards.ts#L678-L679Here is a reproducible example:
It seems to immediately exit, because the promise never resolves or rejects, but also there are no pending events.