diff --git a/Packages/Status/Sources/Status/Detail/StatusDetailView.swift b/Packages/Status/Sources/Status/Detail/StatusDetailView.swift index 937f1f8e..7805e2c3 100644 --- a/Packages/Status/Sources/Status/Detail/StatusDetailView.swift +++ b/Packages/Status/Sources/Status/Detail/StatusDetailView.swift @@ -41,7 +41,7 @@ public struct StatusDetailView: View { case .loading: loadingDetailView - case let .display(status, context): + case let .display(status, context, date): if !context.ancestors.isEmpty { ForEach(context.ancestors) { ancestor in StatusRowView(viewModel: .init(status: ancestor, isCompact: false)) @@ -49,6 +49,7 @@ public struct StatusDetailView: View { } makeCurrentStatusView(status: status) + .id(date) if !context.descendants.isEmpty { ForEach(context.descendants) { descendant in diff --git a/Packages/Status/Sources/Status/Detail/StatusDetailViewModel.swift b/Packages/Status/Sources/Status/Detail/StatusDetailViewModel.swift index 5ea5d827..983548c0 100644 --- a/Packages/Status/Sources/Status/Detail/StatusDetailViewModel.swift +++ b/Packages/Status/Sources/Status/Detail/StatusDetailViewModel.swift @@ -11,7 +11,7 @@ class StatusDetailViewModel: ObservableObject { var client: Client? enum State { - case loading, display(status: Status, context: StatusContext), error(error: Error) + case loading, display(status: Status, context: StatusContext, date: Date), error(error: Error) } @Published var state: State = .loading @@ -25,7 +25,7 @@ class StatusDetailViewModel: ObservableObject { } init(status: Status) { - state = .display(status: status, context: .empty()) + state = .display(status: status, context: .empty(), date: Date()) title = "status.post-from-\(status.account.displayNameWithoutEmojis)" statusId = status.id remoteStatusURL = nil @@ -75,10 +75,10 @@ class StatusDetailViewModel: ObservableObject { title = "status.post-from-\(data.status.account.displayNameWithoutEmojis)" if animate { withAnimation { - state = .display(status: data.status, context: data.context) + state = .display(status: data.status, context: data.context, date: Date()) } } else { - state = .display(status: data.status, context: data.context) + state = .display(status: data.status, context: data.context,date: Date()) scrollToId = statusId } } catch {