Add information about GitHub issue for not working paging for favourited_by and reblogged_by endpoints.

This commit is contained in:
Marcin Czachursk 2023-02-14 08:51:27 +01:00
parent 4caf50e80a
commit 4ffaf9d5a9
3 changed files with 10 additions and 9 deletions

View File

@ -14,7 +14,7 @@ public extension MastodonClientAuthenticated {
target: Mastodon.Statuses.favouritedBy(statusId, nil, nil, nil, nil, page),
withBearerToken: token
)
return try await downloadJson([Account].self, request: request)
}

View File

@ -58,3 +58,4 @@ API in Pixelfed (`/api/v1/instance`) returns JSON with diefferent structure then
- **There are some issues in bookmarks/favourites endpoints**
It seems like paging is not working in that endpoints (I've tried with page and max_id).
Github issue: https://github.com/pixelfed/pixelfed/issues/4182

View File

@ -23,7 +23,7 @@ struct AccountsView: View {
@State var listType: ListType
@State private var accounts: [Account] = []
@State private var page = 1
@State private var downloadedPage = 1
@State private var allItemsLoaded = false
@State private var state: ViewState = .loading
@ -38,7 +38,7 @@ struct AccountsView: View {
case .loading:
LoadingIndicator()
.task {
await self.loadAccounts(page: self.page)
await self.loadAccounts(page: self.downloadedPage)
}
case .loaded:
if self.accounts.isEmpty {
@ -63,8 +63,8 @@ struct AccountsView: View {
Spacer()
LoadingIndicator()
.task {
self.page = self.page + 1
await self.loadAccounts(page: self.page)
self.downloadedPage = self.downloadedPage + 1
await self.loadAccounts(page: self.downloadedPage)
}
Spacer()
}
@ -77,10 +77,10 @@ struct AccountsView: View {
ErrorView(error: error) {
self.state = .loading
self.page = 1
self.downloadedPage = 1
self.allItemsLoaded = false
self.accounts = []
await self.loadAccounts(page: self.page)
await self.loadAccounts(page: self.downloadedPage)
}
.padding()
}
@ -88,7 +88,7 @@ struct AccountsView: View {
private func loadAccounts(page: Int) async {
do {
let accountsFromApi = try await self.loadFromApi()
let accountsFromApi = try await self.loadFromApi(page: page)
if accountsFromApi.isEmpty {
self.allItemsLoaded = true
@ -122,7 +122,7 @@ struct AccountsView: View {
}
}
private func loadFromApi() async throws -> [Account] {
private func loadFromApi(page: Int) async throws -> [Account] {
switch self.listType {
case .followers:
return try await self.client.accounts?.followers(account: self.entityId, page: page) ?? []