fix: lifecycle view model in detail screens (#70)

This commit is contained in:
Diego Beraldin 2023-10-26 19:05:17 +02:00 committed by GitHub
parent ac71df56c7
commit 6178cddef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -112,7 +112,7 @@ class CommunityDetailScreen(
otherInstance = otherInstance,
)
}
model.bindToLifecycle(key)
model.bindToLifecycle(key + community.id.toString())
val uiState by model.uiState.collectAsState()
val lazyListState = rememberLazyListState()
val scope = rememberCoroutineScope()

View File

@ -124,7 +124,7 @@ class PostDetailScreen(
otherInstance = otherInstance,
)
}
model.bindToLifecycle(key)
model.bindToLifecycle(key + post.id.toString())
val uiState by model.uiState.collectAsState()
val isOnOtherInstance = otherInstance.isNotEmpty()
val navigationCoordinator = remember { getNavigationCoordinator() }

View File

@ -110,7 +110,7 @@ class UserDetailScreen(
val model = rememberScreenModel(user.id.toString()) {
getUserDetailViewModel(user, otherInstance)
}
model.bindToLifecycle(key)
model.bindToLifecycle(key + user.id.toString())
val uiState by model.uiState.collectAsState()
val lazyListState = rememberLazyListState()
val scope = rememberCoroutineScope()