Skip to content

Storage category: a file deleted during a search is listed again when the search is cleared #518

Open

Description

@XYIheng

Checklist

  • I can reproduce the bug with the latest version given here.
  • I made sure that there are no existing issues - open or closed - to which I could contribute my information.
  • I made sure that there are no existing discussions - open or closed - to which I could contribute my information.
  • I have read the FAQs inside the app (Menu -> About -> FAQs) and my problem isn't listed.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.
  • I have read and understood the contribution guidelines.

Affected app version

1.6.3

Affected Android/Custom ROM version

Android 16

Affected device model

Xiaomi 17

How did you install the app?

F-Droid / IzzyOnDroid

Steps to reproduce the bug

  1. Have report-alpha.txt and report-gamma.txt in a folder, so that both are listed under Storage → Documents.
  2. Storage tab → Documents → Search → type report-. Both files are listed.
  3. Long-press report-gamma.txt → Delete → Yes. It disappears from the results.
  4. Tap the clear (×) button in the search field.
  5. Tap report-gamma.txt.

Expected behavior

report-gamma.txt is not listed after the search is cleared.

Actual behavior

After step 4 the full list shows report-gamma.txt again. Tapping it (step 5) opens an empty editor for a file that no longer exists. The row goes away only after Documents is reopened.

Screenshots/Screen recordings

No response

Additional information

During a search, the adapter shows a filtered copy of storedItems:

else -> {
ensureBackgroundThread {
if (lastSearchedText != searchNormalizedText) {
return@ensureBackgroundThread
}
val listItems = storedItems.filter {
it.name.normalizeString().contains(searchNormalizedText, true)
} as ArrayList<ListItem>
runOnUiThread {
getRecyclerAdapter()?.updateItems(listItems, text)
binding.apply {
mimetypesFastscroller.beVisibleIf(listItems.isNotEmpty())
mimetypesPlaceholder.beVisibleIf(listItems.isEmpty())
mimetypesPlaceholder2.beGone()
}
}
}
}

Delete removes the item from the adapter's list only; deleteFiles in MimeTypesActivity does not update storedItems, and clearing the search restores storedItems, which still contains the deleted file:

override fun deleteFiles(files: ArrayList<FileDirItem>) {
deleteFiles(files, false) {
if (!it) {
runOnUiThread {
toast(R.string.unknown_error_occurred)
}
}
}
}
override fun selectedPaths(paths: ArrayList<String>) {}
fun searchQueryChanged(text: String) {
val normalizedText = text.normalizeString()
val searchNormalizedText = normalizedText.trim()
lastSearchedText = searchNormalizedText
when {
searchNormalizedText.isEmpty() -> {
binding.apply {
mimetypesFastscroller.beVisible()
getRecyclerAdapter()?.updateItems(storedItems)
mimetypesPlaceholder.beGoneIf(storedItems.isNotEmpty())
mimetypesPlaceholder2.beGone()
}

Possible fix: remove the deleted paths from storedItems in deleteFiles (or reload the items after the delete).

Activity

  1. added
    bugSomething is not working
    needs triageIssue is not yet ready for PR authors to take up
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not workingneeds triageIssue is not yet ready for PR authors to take up

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions