Wiki Search Example will not cancel
deanrad opened this issue · 3 comments
Hi - I'm very curious in using this project. But this looks like a bug:
Given: Most searches should be canceled when a new search term is done, and that's what I take is the intention of using switchMap.
When: A search is performed
Expected: The old search is canceled.
Actual: Because of the use of jQuery and Promises, the Observable returned from fetchTerm
will not be canceled when the search term changes.
I don't have screen shots yet, but based on the code, that's what I believe the behavior will be.
If the rxjs ajax operators were used, cancelability would be built in. And it's not a good example to use jQuery just for something that rxjs already has.
I'm guessing JQuery/JSONP was used because of Wikipedia CORS. The following is relevant to doing that with RxJS: ReactiveX/rxjs#2095
And I just realized that JSONP will not cancel anyway, ha!
I slightly changed the example in #102
Should cancel search now 😅
Wow @NataliaTepluhina - that covers everything - thanks for jumping on that!