Add information about GitHub issue for not working paging for favourited_by and reblogged_by endpoints.
This commit is contained in:
parent
4caf50e80a
commit
4ffaf9d5a9
|
@ -58,3 +58,4 @@ API in Pixelfed (`/api/v1/instance`) returns JSON with diefferent structure then
|
||||||
- **There are some issues in bookmarks/favourites endpoints**
|
- **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).
|
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
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct AccountsView: View {
|
||||||
@State var listType: ListType
|
@State var listType: ListType
|
||||||
|
|
||||||
@State private var accounts: [Account] = []
|
@State private var accounts: [Account] = []
|
||||||
@State private var page = 1
|
@State private var downloadedPage = 1
|
||||||
@State private var allItemsLoaded = false
|
@State private var allItemsLoaded = false
|
||||||
@State private var state: ViewState = .loading
|
@State private var state: ViewState = .loading
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ struct AccountsView: View {
|
||||||
case .loading:
|
case .loading:
|
||||||
LoadingIndicator()
|
LoadingIndicator()
|
||||||
.task {
|
.task {
|
||||||
await self.loadAccounts(page: self.page)
|
await self.loadAccounts(page: self.downloadedPage)
|
||||||
}
|
}
|
||||||
case .loaded:
|
case .loaded:
|
||||||
if self.accounts.isEmpty {
|
if self.accounts.isEmpty {
|
||||||
|
@ -63,8 +63,8 @@ struct AccountsView: View {
|
||||||
Spacer()
|
Spacer()
|
||||||
LoadingIndicator()
|
LoadingIndicator()
|
||||||
.task {
|
.task {
|
||||||
self.page = self.page + 1
|
self.downloadedPage = self.downloadedPage + 1
|
||||||
await self.loadAccounts(page: self.page)
|
await self.loadAccounts(page: self.downloadedPage)
|
||||||
}
|
}
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
@ -77,10 +77,10 @@ struct AccountsView: View {
|
||||||
ErrorView(error: error) {
|
ErrorView(error: error) {
|
||||||
self.state = .loading
|
self.state = .loading
|
||||||
|
|
||||||
self.page = 1
|
self.downloadedPage = 1
|
||||||
self.allItemsLoaded = false
|
self.allItemsLoaded = false
|
||||||
self.accounts = []
|
self.accounts = []
|
||||||
await self.loadAccounts(page: self.page)
|
await self.loadAccounts(page: self.downloadedPage)
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ struct AccountsView: View {
|
||||||
|
|
||||||
private func loadAccounts(page: Int) async {
|
private func loadAccounts(page: Int) async {
|
||||||
do {
|
do {
|
||||||
let accountsFromApi = try await self.loadFromApi()
|
let accountsFromApi = try await self.loadFromApi(page: page)
|
||||||
|
|
||||||
if accountsFromApi.isEmpty {
|
if accountsFromApi.isEmpty {
|
||||||
self.allItemsLoaded = true
|
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 {
|
switch self.listType {
|
||||||
case .followers:
|
case .followers:
|
||||||
return try await self.client.accounts?.followers(account: self.entityId, page: page) ?? []
|
return try await self.client.accounts?.followers(account: self.entityId, page: page) ?? []
|
||||||
|
|
Loading…
Reference in New Issue