Pinned posts cause profile timeline to skip into the past when scrolling #553

Closed
opened 2019-05-22 08:05:32 +00:00 by kaniini · 16 comments
Member
  1. Pin a post from a week ago.
  2. Scroll through posts.
  3. Suddenly you've jumped back a week, even though you have many posts newer than that.

This is probably fixed by not adding the pinned posts to the profile timeline twice.

1. Pin a post from a week ago. 2. Scroll through posts. 3. Suddenly you've jumped back a week, even though you have many posts newer than that. This is probably fixed by not adding the pinned posts to the profile timeline twice.
Member

sounds like a bigger issue. Although i don't like the idea of NOT adding pinned posts twice.

sounds like a bigger issue. Although i don't like the idea of NOT adding pinned posts twice.
Member

I have the same issue on my profile timeline. https://ministry.moonbutt.science/winzstd

I pinned a post right after I'd posted it. I don't remember have I pinned it twice, probably not.

Currenlty, there are exactly the 20 latest posts on my timeline. The posts between these and the pinned post don't appear.

I have the same issue on my profile timeline. https://ministry.moonbutt.science/winzstd I pinned a post right after I'd posted it. I don't remember have I pinned it twice, probably not. Currenlty, there are exactly the 20 latest posts on my timeline. The posts between these and the pinned post don't appear.
Member

And there https://ministry.moonbutt.science/commagray

  • Two pinned posts;
  • 20 latest posts are visible;
  • The next posts before the first pinned post are skipped;
  • All the posts between the two pinned posts are skipped;
  • All the post earlier than the first pinned post are visible.
And there https://ministry.moonbutt.science/commagray * Two pinned posts; * 20 latest posts are visible; * The next posts before the first pinned post are skipped; * All the posts between the two pinned posts are skipped; * All the post earlier than the first pinned post are visible.
Member

I was trying to reproduce this issue. Anyone still seeing it? More info would help track down the issue.

I was trying to reproduce this issue. Anyone still seeing it? More info would help track down the issue.
Member

@wyatt777 you can visit my profile: https://shigusegubu.club/hj

Basically what is happening:

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 and not quite easy to actually fix it properly without ripping pinned posts out of context and other issues.

@wyatt777 you can visit my profile: https://shigusegubu.club/hj Basically what is happening: 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 and not quite easy to actually fix it properly without ripping pinned posts out of context and other issues.
Member

Hi @hj thanks.

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.

You can ignore this until I test it locally.

Hi @hj thanks. 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. **You can ignore this until I test it locally.**
Member

More on how maxId is used so it can be reviewed easier. Time line fetcher
I was able to reproduce it locally.

More on how maxId is used so it can be reviewed easier. [Time line fetcher](https://git.pleroma.social/pleroma/pleroma-fe/blob/develop/src/services/timeline_fetcher/timeline_fetcher.service.js) I was able to reproduce it locally.
Member

@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.

@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.
Owner

I think there's something else going on here. Every time you hit the bottom of the statuses of a profile with pinned statuses they get loaded again.

pinned_profile

I think there's something else going on here. Every time you hit the bottom of the statuses of a profile with pinned statuses they get loaded again. ![pinned_profile](/uploads/ceca81db91215c6c26103c0084209a54/pinned_profile.m4v)
Member

@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 2
Post 3
Post 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 1
Post 2
Post 3
Post 4
Post 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 1
Post 2
Post 3
Post 4
Post 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.

@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 2 Post 3 Post 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 1 Post 2 Post 3 Post 4 Post 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 1 Post 2 Post 3 Post 4 Post 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.

I don't see this behavior, has this been fixed?

I don't see this behavior, has this been fixed?
Member

i see it on my instance on my profile

at least the issue with "pinned post always at the bottom"

i see it on my instance on my profile at least the issue with "pinned post always at the bottom"
Member

the "loading jumps a week" however has been fixed

the "**loading** jumps a week" however has been fixed

I found a backend bug relating to this...

I found a backend bug relating to this...
Member

it's a frontend bug, really, as I mentioned above.

it's a frontend bug, really, as I mentioned above.

yeah, i know, just found an additional bug :)

yeah, i know, just found an additional bug :)
Sign in to join this conversation.
No milestone
No project
No assignees
6 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pleroma/pleroma-fe#553
No description provided.