From 1a14095af664a3bc9105c7f2a9dd07bc0e78d3bc Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 5 Jun 2025 00:02:19 +0530 Subject: [PATCH] fix: reset to loading state on next update Fixes #847 --- .../dev/msfjarvis/claw/common/comments/CommentsViewModel.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentsViewModel.kt b/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentsViewModel.kt index 9e5e96eb..839369ac 100644 --- a/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentsViewModel.kt +++ b/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/CommentsViewModel.kt @@ -45,6 +45,10 @@ constructor( var postDetails by mutableStateOf(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 { withContext(ioDispatcher) {