From 1dc7ef137cb7a546b1c84c1e7304a4f74ea1e66b Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 13 Sep 2024 15:01:09 +0100 Subject: Fix notification->post jump for real (#5314) * Revert "Fix notification scroll jump (#5297)" This reverts commit e0d9e75407b053dd3b7a3472f925d8cd4bd92d45. * Query notifications first --- src/state/queries/post-thread.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/state/queries/post-thread.ts') diff --git a/src/state/queries/post-thread.ts b/src/state/queries/post-thread.ts index 83ca60c2a..a569cb160 100644 --- a/src/state/queries/post-thread.ts +++ b/src/state/queries/post-thread.ts @@ -408,10 +408,14 @@ export function* findAllPostsInQueryData( } } } - for (let post of findAllPostsInFeedQueryData(queryClient, uri)) { + for (let post of findAllPostsInNotifsQueryData(queryClient, uri)) { + // Check notifications first. If you have a post in notifications, + // it's often due to a like or a repost, and we want to prioritize + // a post object with >0 likes/reposts over a stale version with no + // metrics in order to avoid a notification->post scroll jump. yield postViewToPlaceholderThread(post) } - for (let post of findAllPostsInNotifsQueryData(queryClient, uri)) { + for (let post of findAllPostsInFeedQueryData(queryClient, uri)) { yield postViewToPlaceholderThread(post) } for (let post of findAllPostsInQuoteQueryData(queryClient, uri)) { -- cgit 1.4.1