# coroutines

Abhishek Dewan

06/23/2021, 5:41 PM
I am pretty sure that I am missing something obvious but in the following code the first emission from the notificationsViewModel StateFlow works but when I call the refresh function it doesn’t flow the updates through notificationsViewModel. What am I missing here? (Apologize about the naming conventions as they may be confusing)
👍 1
Solved it. The problem was that StateFlow<T> won’t trigger if the value doesn’t change. The way to fix it was to emit a Loading state before reaching out to the network, so that even if the remote data doesn’t change, flow will emit the same data again.