Skip to content
Discussion options

You must be logged in to vote

Thank you, it wasn't as straightforward from the example because fetch and axios handle cancellation automatically but in my case I had to do it manually, just checking for signal.aborted sufficed.
Also I realized far too late I had a bunch of mistakes in my code that made things worse, like missing a negation on the enable condition and not returning the data properly from the promise.
Thanks to the example I managed to do it without any explicit cancellations, now the cancellation is properly called and the final search function looks like this:

const innerSearch = async (text, signal) => {
		const data = await new Promise((resolve, reject) => {
			window.addEventListener('searchResults…

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@MaddoScientisto
Comment options

@MaddoScientisto
Comment options

@samhirtarif
Comment options

@MaddoScientisto
Comment options

Answer selected by MaddoScientisto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants