Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix notification->post jump for real (#5314)

* Revert "Fix notification scroll jump (#5297)"

This reverts commit e0d9e75407b053dd3b7a3472f925d8cd4bd92d45.

* Query notifications first

authored by

dan and committed by
GitHub
1dc7ef13 0315814e

+6 -21
-19
src/state/queries/notifications/util.ts
··· 175 175 }> { 176 176 const postUris = new Set<string>() 177 177 const packUris = new Set<string>() 178 - 179 - const postUrisWithLikes = new Set<string>() 180 - const postUrisWithReposts = new Set<string>() 181 - 182 178 for (const notif of groupedNotifs) { 183 179 if (notif.subjectUri?.includes('app.bsky.feed.post')) { 184 180 postUris.add(notif.subjectUri) 185 - if (notif.type === 'post-like') { 186 - postUrisWithLikes.add(notif.subjectUri) 187 - } 188 - if (notif.type === 'repost') { 189 - postUrisWithReposts.add(notif.subjectUri) 190 - } 191 181 } else if ( 192 182 notif.notification.reasonSubject?.includes('app.bsky.graph.starterpack') 193 183 ) { ··· 216 206 AppBskyFeedPost.validateRecord(post.record).success 217 207 ) { 218 208 postsMap.set(post.uri, post) 219 - 220 - // HACK. In some cases, the appview appears to lag behind and returns empty counters. 221 - // To prevent scroll jump due to missing metrics, fill in 1 like/repost instead of 0. 222 - if (post.likeCount === 0 && postUrisWithLikes.has(post.uri)) { 223 - post.likeCount = 1 224 - } 225 - if (post.repostCount === 0 && postUrisWithReposts.has(post.uri)) { 226 - post.repostCount = 1 227 - } 228 209 } 229 210 } 230 211 for (const pack of packsChunks.flat()) {
+6 -2
src/state/queries/post-thread.ts
··· 408 408 } 409 409 } 410 410 } 411 - for (let post of findAllPostsInFeedQueryData(queryClient, uri)) { 411 + for (let post of findAllPostsInNotifsQueryData(queryClient, uri)) { 412 + // Check notifications first. If you have a post in notifications, 413 + // it's often due to a like or a repost, and we want to prioritize 414 + // a post object with >0 likes/reposts over a stale version with no 415 + // metrics in order to avoid a notification->post scroll jump. 412 416 yield postViewToPlaceholderThread(post) 413 417 } 414 - for (let post of findAllPostsInNotifsQueryData(queryClient, uri)) { 418 + for (let post of findAllPostsInFeedQueryData(queryClient, uri)) { 415 419 yield postViewToPlaceholderThread(post) 416 420 } 417 421 for (let post of findAllPostsInQuoteQueryData(queryClient, uri)) {