Fix to react-key uniqueness in feeds (#1136)
parent
872a7f93f4
commit
3c29a1be4d
|
@ -17,6 +17,12 @@ export class FeedViewPostsSlice {
|
||||||
|
|
||||||
constructor(public items: FeedViewPost[] = []) {}
|
constructor(public items: FeedViewPost[] = []) {}
|
||||||
|
|
||||||
|
get _reactKey() {
|
||||||
|
return `slice-${this.rootItem.post.uri}-${
|
||||||
|
this.rootItem.reason?.indexedAt || this.rootItem.post.indexedAt
|
||||||
|
}`
|
||||||
|
}
|
||||||
|
|
||||||
get uri() {
|
get uri() {
|
||||||
if (this.isFlattenedReply) {
|
if (this.isFlattenedReply) {
|
||||||
return this.items[1].post.uri
|
return this.items[1].post.uri
|
||||||
|
|
|
@ -11,7 +11,7 @@ export class PostsFeedSliceModel {
|
||||||
items: PostsFeedItemModel[] = []
|
items: PostsFeedItemModel[] = []
|
||||||
|
|
||||||
constructor(public rootStore: RootStoreModel, slice: FeedViewPostsSlice) {
|
constructor(public rootStore: RootStoreModel, slice: FeedViewPostsSlice) {
|
||||||
this._reactKey = `slice-${slice.uri}`
|
this._reactKey = slice._reactKey
|
||||||
for (let i = 0; i < slice.items.length; i++) {
|
for (let i = 0; i < slice.items.length; i++) {
|
||||||
this.items.push(
|
this.items.push(
|
||||||
new PostsFeedItemModel(
|
new PostsFeedItemModel(
|
||||||
|
|
Loading…
Reference in New Issue