Fix: dont dedup reposts that are in threads, as that can cause rendering issues (close #71)

zio/stable
Paul Frazee 2023-01-25 17:57:53 -06:00
parent e08a46f0c6
commit 67e9b3596d
1 changed files with 10 additions and 0 deletions

View File

@ -87,6 +87,12 @@ export class FeedItemModel {
this.reason = v.reason this.reason = v.reason
} }
get _isRenderingAsThread() {
return (
this._isThreadParent || this._isThreadChild || this._isThreadChildElided
)
}
get reasonRepost(): ReasonRepost | undefined { get reasonRepost(): ReasonRepost | undefined {
if (this.reason?.$type === 'app.bsky.feed.feedViewPost#reasonRepost') { if (this.reason?.$type === 'app.bsky.feed.feedViewPost#reasonRepost') {
return this.reason as ReasonRepost return this.reason as ReasonRepost
@ -627,6 +633,10 @@ function dedupReposts(feed: FeedItemModel[]) {
const item1 = feed[i] const item1 = feed[i]
for (let j = i + 1; j < feed.length; j++) { for (let j = i + 1; j < feed.length; j++) {
const item2 = feed[j] const item2 = feed[j]
if (item2._isRenderingAsThread) {
// dont dedup items that are rendering in a thread as this can cause rendering errors
continue
}
if (item1.post.uri === item2.post.uri) { if (item1.post.uri === item2.post.uri) {
feed.splice(j, 1) feed.splice(j, 1)
j-- j--