Skip to content

Commit

Permalink
Add a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarvis Lin committed Feb 19, 2024
1 parent b83c0b6 commit 3e48382
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class NotesAdapter(context: Context, private val inlineActionEvents: MutableShar
*/
fun addAll(notes: List<Note>) = coroutineScope.launch {
withContext(Dispatchers.Main) {
// make sure that the differ should be in the main thread, otherwise it will throw an IndexOutOfBoundsException
val newNotes = buildFilteredNotesList(notes, currentFilter)
val differ = AsyncListDiffer(this@NotesAdapter, object : ItemCallback<Note>() {
override fun areItemsTheSame(oldItem: Note, newItem: Note): Boolean =
Expand Down

0 comments on commit 3e48382

Please sign in to comment.