Skip to content

Commit 7d28ac9

Browse files
author
Yevhen Babiichuk (DustDFG)
committed
Fix bug of search history randomly not saved
Don't create disposable from operation of storing search to history because as we certainly want this to complete. Disposable was created in `search` method and then alsmost immediately was called `startLoading` which disposed "all" disposables including our operation of search storing (if was unlucky enough to not finish before this moment)
1 parent 2f063a7 commit 7d28ac9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,14 +865,15 @@ private void search(@NonNull final String theSearchString,
865865
hideKeyboardSearch();
866866

867867
// store search query if search history is enabled
868-
disposables.add(historyRecordManager.onSearched(serviceId, theSearchString)
868+
869+
historyRecordManager.onSearched(serviceId, theSearchString)
869870
.observeOn(AndroidSchedulers.mainThread())
870871
.subscribe(
871872
ignored -> {
872873
},
873874
throwable -> showSnackBarError(new ErrorInfo(throwable, UserAction.SEARCHED,
874875
theSearchString, serviceId))
875-
));
876+
);
876877

877878
// load search results
878879
suggestionPublisher.onNext(theSearchString);

0 commit comments

Comments
 (0)