Skip to content

Commit

Permalink
Fix the marker restore
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimillian committed Sep 19, 2024
1 parent df19135 commit 4338e0a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Packages/Timeline/Sources/Timeline/View/TimelineViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import SwiftUI
var statusesState: StatusesState = .loading
var timeline: TimelineFilter = .home {
willSet {
if timeline == .home, newValue != .resume {
if timeline == .home,
newValue != .resume,
newValue != timeline {
saveMarker()
}
}
Expand Down Expand Up @@ -176,8 +178,11 @@ extension TimelineViewModel: StatusesFetcher {
func fetchStatuses(from: Marker.Content) async throws {
guard let client else { return }
statusesState = .loading
var statuses: [Status] = try await statusFetcher.fetchFirstPage(client: client,
timeline: timeline)
var statuses: [Status] = try await client.get(endpoint: timeline.endpoint(sinceId: nil,
maxId: from.lastReadId,
minId: nil,
offset: 0,
limit: 40))

StatusDataControllerProvider.shared.updateDataControllers(for: statuses, client: client)

Expand Down

0 comments on commit 4338e0a

Please sign in to comment.