Proper fix for looping timeline
This commit is contained in:
parent
1e7c25993a
commit
47436daaf2
|
@ -48,19 +48,17 @@ public struct StatusesListView<Fetcher>: View where Fetcher: StatusesFetcher {
|
|||
|
||||
case let .display(statuses, nextPageState):
|
||||
ForEach(statuses, id: \.viewId) { status in
|
||||
if !status.isHidden {
|
||||
StatusRowView(viewModel: StatusRowViewModel(status: status,
|
||||
client: client,
|
||||
routerPath: routerPath,
|
||||
isRemote: isRemote))
|
||||
.id(status.id)
|
||||
.onAppear {
|
||||
fetcher.statusDidAppear(status: status)
|
||||
}
|
||||
.onDisappear {
|
||||
fetcher.statusDidDisappear(status: status)
|
||||
}
|
||||
}
|
||||
StatusRowView(viewModel: StatusRowViewModel(status: status,
|
||||
client: client,
|
||||
routerPath: routerPath,
|
||||
isRemote: isRemote))
|
||||
.id(status.id)
|
||||
.onAppear {
|
||||
fetcher.statusDidAppear(status: status)
|
||||
}
|
||||
.onDisappear {
|
||||
fetcher.statusDidDisappear(status: status)
|
||||
}
|
||||
}
|
||||
switch nextPageState {
|
||||
case .hasNextPage:
|
||||
|
|
|
@ -269,6 +269,7 @@ extension TimelineViewModel: StatusesFetcher {
|
|||
StatusDataControllerProvider.shared.updateDataControllers(for: statuses, client: client)
|
||||
|
||||
await datasource.set(statuses)
|
||||
statuses = await datasource.get()
|
||||
await cacheHome()
|
||||
|
||||
withAnimation {
|
||||
|
|
|
@ -9,7 +9,7 @@ actor TimelineDatasource {
|
|||
}
|
||||
|
||||
func get() -> [Status] {
|
||||
statuses
|
||||
statuses.filter{ !$0.isHidden }
|
||||
}
|
||||
|
||||
func count() -> Int {
|
||||
|
|
Loading…
Reference in New Issue