-
Notifications
You must be signed in to change notification settings - Fork 758
Add a way to stop an ongoing project search #7621
Add a way to stop an ongoing project search #7621
Conversation
First, the search operation is assigned a cancellation function that can be used to stop the search. Next, when a new search is started, it is saved in state so that it can later be cancelled. The ongoing search is cancelled when: - A new project search is started. - A user clicks the "x" button on the search input.
This action is not used.
await dispatch(clearSearchResults()); | ||
await dispatch(addSearchQuery(query)); | ||
dispatch(updateSearchStatus(statusType.fetching)); | ||
const validSources = getSourceList(getState()).filter( | ||
source => !hasPrettySource(getState(), source.id) && !isThirdParty(source) | ||
); | ||
for (const source of validSources) { | ||
if (cancelled) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this 👍
This is great! @Garee :) |
- Use ProjectTextSearch selectors - Rename 'search' state to 'ongoingSearch' - Move stopOngoingSearch() into searchSources() and closeProjectSearch()
Looks good to me, we'll probably need to set the status of the search as |
I added and set a new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :) Nice work!
We can do some follow up tweaks
@AnshulMalik What ideas do you have for follow up tweaks? |
@darkwing A few
|
Great work @Garee ! I love it! |
Summary
First, the search operation is assigned a cancellation function that can be used to stop the search. Next, when a new search is started, it is saved in state so that it can later be cancelled.
The ongoing search is cancelled when:
Fixes #7559
Testing
Other