mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-12 06:37:15 +01:00
Fix timeline cache caching something else than home Fix #710
This commit is contained in:
parent
b30b96c48d
commit
49791d2c86
@ -20,6 +20,7 @@ public class StatusEditorViewModel: NSObject, ObservableObject {
|
||||
textView?.pasteDelegate = self
|
||||
}
|
||||
}
|
||||
|
||||
var selectedRange: NSRange {
|
||||
get {
|
||||
guard let textView else {
|
||||
|
@ -149,7 +149,7 @@ extension TimelineViewModel: StatusesFetcher {
|
||||
func fetchStatuses() async {
|
||||
guard let client else { return }
|
||||
do {
|
||||
if statuses.isEmpty {
|
||||
if statuses.isEmpty || timeline == .trending {
|
||||
try await fetchFirstPage(client: client)
|
||||
} else if let latest = statuses.first {
|
||||
try await fetchNewPagesFrom(latestStatus: latest, client: client)
|
||||
@ -193,12 +193,13 @@ extension TimelineViewModel: StatusesFetcher {
|
||||
statuses = try await client.get(endpoint: timeline.endpoint(sinceId: nil,
|
||||
maxId: nil,
|
||||
minId: nil,
|
||||
offset: statuses.count))
|
||||
offset: 0))
|
||||
|
||||
updateMentionsToBeHighlighted(&statuses)
|
||||
ReblogCache.shared.removeDuplicateReblogs(&statuses)
|
||||
|
||||
await cacheHome()
|
||||
|
||||
withAnimation {
|
||||
statusesState = .display(statuses: statuses, nextPageState: statuses.count < 20 ? .none : .hasNextPage)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user