From 3d60b4a20821809125f5814c959d9ae5c48b60a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20Manuel=20Cernuda?= Date: Wed, 10 Aug 2022 10:20:58 +0200 Subject: [PATCH] Fix issue in ViewModel: View is not refresh after delete all items --- app/src/main/java/com/bawp/jetnote/screen/NoteViewModel.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/bawp/jetnote/screen/NoteViewModel.kt b/app/src/main/java/com/bawp/jetnote/screen/NoteViewModel.kt index 1d60c23..19559f0 100644 --- a/app/src/main/java/com/bawp/jetnote/screen/NoteViewModel.kt +++ b/app/src/main/java/com/bawp/jetnote/screen/NoteViewModel.kt @@ -29,6 +29,7 @@ class NoteViewModel @Inject constructor(private val repository: NoteRepository) .collect { listOfNotes -> if (listOfNotes.isNullOrEmpty()) { Log.d("Empty", ": Empty list") + _noteList.value = emptyList() }else { _noteList.value = listOfNotes }