fix: 退出贴子页面保存历史记录时偶现闪退

This commit is contained in:
HuanCheng65 2023-10-04 01:07:49 +08:00
parent 17301cf540
commit d4cad7045d
No known key found for this signature in database
GPG Key ID: 5EC9DD60A32C7360
1 changed files with 22 additions and 20 deletions

View File

@ -392,7 +392,7 @@ object ThreadPageFrom {
sealed interface ThreadPageExtra
@Serializable
object ThreadPageNoExtra : ThreadPageExtra
data object ThreadPageNoExtra : ThreadPageExtra
@Serializable
data class ThreadPageFromStoreExtra(
@ -772,6 +772,7 @@ fun ThreadPage(
LaunchedEffect(threadId, threadTitle, author, lastVisibilityPostId) {
val saveHistory = {
thread {
runCatching {
if (threadTitle.isNotBlank()) {
HistoryUtil.saveHistory(
History(
@ -794,6 +795,7 @@ fun ThreadPage(
}
}
}
}
if (!savedHistory || lastVisibilityPostId != 0L) {
saveHistory()