Skip to content

Fix bug of search history randomly not saved#13061

Closed
ghost wants to merge 1 commit intodevfrom
unknown repository
Closed

Fix bug of search history randomly not saved#13061
ghost wants to merge 1 commit intodevfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost 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
Copy Markdown
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
Copy Markdown
Author

@ghost ghost 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

@ghost ghost marked this pull request as draft January 14, 2026 15:32
@ghost ghost closed this Jan 19, 2026
@ShareASmile ShareASmile added bug Issue is related to a bug search Anything related to the search function labels Jan 29, 2026
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue is related to a bug search Anything related to the search function 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