1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Improve marker loading

Actually the id can be invalid (not found), and the timeline can be loaded to the right position, therefore no need to check the id anymore.
This commit is contained in:
xmflsct
2023-02-03 13:11:15 +01:00
parent 2a774a5516
commit 242ecf76c0
2 changed files with 30 additions and 26 deletions

View File

@ -61,20 +61,9 @@ export const queryFunctionTimeline = async ({
let marker: string | undefined
if (page.page === 'Following' && !pageParam?.offset && !pageParam?.min_id && !pageParam?.max_id) {
const storedMarker = getAccountStorage.string('read_marker_following')
if (storedMarker) {
await apiInstance<Mastodon.Status[]>({
method: 'get',
url: 'timelines/home',
params: { limit: 1, min_id: storedMarker }
}).then(res => {
if (res.body.length) {
marker = storedMarker
}
})
}
marker = getAccountStorage.string('read_marker_following')
}
let params: { [key: string]: string } = marker
const params: { [key: string]: string } = marker
? { limit: 40, max_id: marker }
: { limit: 40, ...pageParam }