diff --git a/android/app/src/main/java/com/fabledsword/thoughtsync/ui/BoardViewModel.kt b/android/app/src/main/java/com/fabledsword/thoughtsync/ui/BoardViewModel.kt index eb7121e..a4d71fd 100644 --- a/android/app/src/main/java/com/fabledsword/thoughtsync/ui/BoardViewModel.kt +++ b/android/app/src/main/java/com/fabledsword/thoughtsync/ui/BoardViewModel.kt @@ -472,9 +472,13 @@ class BoardViewModel( * correct-until-a-moment-ago content, and flashing it empty would be a worse * lie than showing it one frame stale. * - * Search results are left alone — they are the answer to a query, not a live - * view, and re-running the board query underneath them would replace the hits - * with the whole board. + * While a search is running the QUERY is re-run rather than the board's + * destination — running `load` here would replace the hits with the whole + * board, which is why this branch exists at all. It used to keep the existing + * list instead, and that was right for a note whose place in the pile changed + * and wrong for one that left it: trashing a hit left the card sitting there, + * with a snackbar saying it was gone, until the query happened to re-run + * (#3111). Re-asking is still the answer to the query, just a current one. */ private fun mutate( closeEditor: Boolean = false, @@ -486,10 +490,8 @@ class BoardViewModel( try { val updated = withContext(Dispatchers.IO) { block(core) } val notes = - if (state.searching) { - state.notes - } else { - withContext(Dispatchers.IO) { load(state.destination) } + withContext(Dispatchers.IO) { + if (state.searching) core.searchNotes(state.query) else load(state.destination) } // On IO, not here: re-deriving the alarm reads every note // that carries a reminder, and this line runs on the main