Skip to content

Conversation

@dustdfg
Copy link
Contributor

@dustdfg dustdfg commented Jan 14, 2026

What is it?

  • Bugfix (user facing)

Description of the changes in your PR

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)

Fixes the following issue(s)

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

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)
@github-actions github-actions bot added the size/small PRs with less than 50 changed lines label Jan 14, 2026
disposables.add(historyRecordManager.onSearched(serviceId, theSearchString)

historyRecordManager.onSearched(serviceId, theSearchString)
.observeOn(AndroidSchedulers.mainThread())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I should change it to shedulers io?

.subscribe(
ignored -> {
},
throwable -> showSnackBarError(new ErrorInfo(throwable, UserAction.SEARCHED,
Copy link
Contributor Author

@dustdfg dustdfg Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still not sure it is safe because of call to showSnackBarError. The same thing is with delete history item operations in the file...

Please help to answer following questions:

  1. Is current approach of this PR safe?
  2. If not safe maybe I should create separate composite disposable specifically for db these db related tasks?
    2.1. ...And then rename disposables variable as would be used for only one purpose a bit above this code (checking if search is url which can be opened in newpipe directly...)

I am almost sure 2 + 2.1 is the best way to go but Idk

@dustdfg dustdfg marked this pull request as draft January 14, 2026 15:32
@dustdfg dustdfg closed this Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/small PRs with less than 50 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

At random searches are not saved in list

1 participant