about summary refs log tree commit diff
path: root/src/state/queries/post-thread.ts
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-09-13 15:01:09 +0100
committerGitHub <noreply@github.com>2024-09-13 15:01:09 +0100
commit1dc7ef137cb7a546b1c84c1e7304a4f74ea1e66b (patch)
tree424cc08e9a7165449361d77afa0cb82b17179e86 /src/state/queries/post-thread.ts
parent0315814eddca8af027f855cd8cfc9f139004c162 (diff)
downloadvoidsky-1dc7ef137cb7a546b1c84c1e7304a4f74ea1e66b.tar.zst
Fix notification->post jump for real (#5314)
* Revert "Fix notification scroll jump (#5297)"

This reverts commit e0d9e75407b053dd3b7a3472f925d8cd4bd92d45.

* Query notifications first
Diffstat (limited to 'src/state/queries/post-thread.ts')
-rw-r--r--src/state/queries/post-thread.ts8
1 files changed, 6 insertions, 2 deletions
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)) {