Skip to content

Commit

Permalink
Fix: only use scroll-positioning control on thread when looking at re…
Browse files Browse the repository at this point in the history
…plies (#1587)
  • Loading branch information
pfrazee authored Oct 4, 2023
1 parent 5886593 commit 6598fca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/state/models/content/post-thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {makeAutoObservable, runInAction} from 'mobx'
import {
AppBskyFeedGetPostThread as GetPostThread,
AppBskyFeedDefs,
AppBskyFeedPost,
PostModeration,
} from '@atproto/api'
import {AtUri} from '@atproto/api'
Expand Down Expand Up @@ -76,6 +77,13 @@ export class PostThreadModel {
return this.rootStore.mutedThreads.uris.has(this.rootUri)
}

get isCachedPostAReply() {
if (AppBskyFeedPost.isRecord(this.thread?.post.record)) {
return !!this.thread?.post.record.reply
}
return false
}

// public api
// =

Expand Down
2 changes: 1 addition & 1 deletion src/view/com/post-thread/PostThread.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export const PostThread = observer(function PostThread({
data={posts}
initialNumToRender={posts.length}
maintainVisibleContentPosition={
isNative && view.isFromCache
isNative && view.isFromCache && view.isCachedPostAReply
? MAINTAIN_VISIBLE_CONTENT_POSITION
: undefined
}
Expand Down

0 comments on commit 6598fca

Please sign in to comment.