BaseApp-Jetpack-Compose-Android-Kotlin icon indicating copy to clipboard operation
BaseApp-Jetpack-Compose-Android-Kotlin copied to clipboard

How to force state update after editing data and navigating back?

Open Eivyses opened this issue 1 year ago • 0 comments

Hello, I'm using this repo as starting blocks for my project. Currently I ran into an issue of room database data not being updated after navigating back. So, what happens is:

  • open app (view 1) and go to view that lists elements (view 2)
  • select specific element from a list to open edit view (view 3)
  • delete some kind of entry in edit view
  • navigate back (to view 2)
  • view that lists elements still contains deleted info

If I were to navigate back once more to view 1 and then open view 2 then I would see updated data. I am using two different view models as I have two different Screens/Views. I assume this happens due to ViewModel not invoking init block on navigate.navigateUp() but I might be wrong.

Does anyone know a solution for this?

Eivyses avatar Feb 09 '24 14:02 Eivyses