Angular · Middle · Question 17 of 75
Why add distinctUntilChanged() after debounceTime(300) in a search box?
- ✓Correct answer: To skip the request when the debounced text is the same as the previous one
- 2To make the debounce shorter
- 3To sort the search results
Explanation
Typing "ab", deleting "b" and typing it again within the debounce window produces "ab" again. distinctUntilChanged drops that duplicate before switchMap sends a request.