mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-23 06:18:08 +00:00
StatusDataController: Properly fix update cycle
This commit is contained in:
parent
57197b9e9a
commit
05da36c27a
3 changed files with 6 additions and 6 deletions
|
@ -32,7 +32,6 @@ public final class StatusDataControllerProvider {
|
|||
public func dataController(for status: any AnyStatus, client: Client) -> StatusDataController {
|
||||
let key = CacheKey(statusId: status.id, client: client)
|
||||
if let controller = cache[key] as? StatusDataController {
|
||||
controller.updateFrom(status: status, publishUpdate: false)
|
||||
return controller
|
||||
}
|
||||
let controller = StatusDataController(status: status, client: client)
|
||||
|
|
|
@ -150,11 +150,6 @@ public struct StatusDetailView: View {
|
|||
}
|
||||
}
|
||||
.id(status.id)
|
||||
.onAppear {
|
||||
StatusDataControllerProvider.shared.dataController(for: status.reblog ?? status,
|
||||
client: client)
|
||||
.updateFrom(status: status, publishUpdate: true)
|
||||
}
|
||||
}
|
||||
|
||||
private var errorView: some View {
|
||||
|
|
|
@ -2,6 +2,7 @@ import Foundation
|
|||
import Models
|
||||
import Network
|
||||
import SwiftUI
|
||||
import Env
|
||||
|
||||
@MainActor
|
||||
class StatusDetailViewModel: ObservableObject {
|
||||
|
@ -78,6 +79,11 @@ class StatusDetailViewModel: ObservableObject {
|
|||
var statuses = data.context.ancestors
|
||||
statuses.append(data.status)
|
||||
statuses.append(contentsOf: data.context.descendants)
|
||||
|
||||
StatusDataControllerProvider.shared.dataController(for: data.status,
|
||||
client: client)
|
||||
.updateFrom(status: data.status, publishUpdate: true)
|
||||
|
||||
if animate {
|
||||
withAnimation {
|
||||
isLoadingContext = false
|
||||
|
|
Loading…
Reference in a new issue