fix: reset to loading state on next update

Fixes #847
This commit is contained in:
Harsh Shandilya 2025-06-05 00:02:19 +05:30
parent da3ca63085
commit 1a14095af6

View file

@ -45,6 +45,10 @@ constructor(
var postDetails by mutableStateOf<NetworkState>(NetworkState.Loading)
suspend fun loadPostDetails(postId: String) {
if (postDetails is NetworkState.Error) {
// If the post details failed to load previously, reset the state to loading
postDetails = NetworkState.Loading
}
postDetails =
runSuspendCatching<UIPost> {
withContext(ioDispatcher) {