FE fetches recent posts and pinned posts. In most cases if there are pinned posts they are quite old. What ends up happening is that system knows 20 recent post and 1 old one, when fetching older posts it uses the oldest post it knows as a reference, so instead of querying posts starting from last recent post it fetches them using pinned post because it's the oldest one.
This issue is somewhat related to the duplicated pinned posts #549 (closed) and not quite easy to actually fix it properly without ripping pinned posts out of context and other issues.
In src/modules/statuses.js it seems to get the maxId (oldest post) using lodash maxBy.
If maxBy was rewritten to ignore pinned posts, it might fix this.
Something like:
const maxBy = (array, iteratee) => { let result if (array == null) { return result } let computed for (const value of array) { let current = 0 if (!value.pinned) { current = value[iteratee] } if (current != null && (computed === undefined ? (!isSymbol(current)) : (current > computed) )) { computed = current result = value } } return result}
i.e. never use pinned posts to do the API call for timelines.
On local the pinned posts are still at the top and show in their original timeline place below.
If I can reproduce the original issue locally I will test it out with that.
@hj I was able to resolve this locally in src/modules/statuses.js
fetchPinnedStatuses: I added another variable here isPinned set to true.
When it is true addNewStatuses does not reset the maxId or minId of the timeline.
Local testing: multiple / single pinned statuses are still at the top of the timeline. The timeline no longer skips statuses as described in this issue.
@feld basically when displaying user timeline it displays all known posts sorted by their id (read = time, for local users).
Internally it knows about:
User's recent posts
User's pinned posts (which could be months old)
It displays in UI, in separate lists:
User's pinned posts
All user's posts
All users's posts have certain filters so that they don't contain pinned posts if they are the very beginning, so you don't get situations like this
Post 1 [Pinned]Post 1 [Pinned]Post 2Post 3Post 4
however since FE knows about pinned posts it will show it at the bottom of all known posts because they are the oldest.
Post 99 [Pinned]Post 1Post 2Post 3Post 4Post 99 [Pinned]
We need to somehow know whether we should show old pinned post in all posts list or not, so that can render such situations correctly:
Post 5 [pinned]Post 1Post 2Post 3Post 4Post 5 [pinned]Post 6
This issue was about that loading was broken (it's fixed now) since it essentially started loading posts after the oldest post (which is pinned, now ignored), i suggest opening another issue, you may even copy-paste my comment explaining the situation.