logs-content: Fixed post being added twice on add due to race condition between websocket and mutation return.
This commit is contained in:
@@ -111,6 +111,11 @@ module.exports = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
postAdded(post) {
|
postAdded(post) {
|
||||||
|
// Stop duplicates in case of race condition.
|
||||||
|
if (this.state.log.posts.find(p => p.id === post.id)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.state.log.posts = this.state.log.posts.concat([post])
|
this.state.log.posts = this.state.log.posts.concat([post])
|
||||||
this.state.log = Object.assign({}, this.state.log)
|
this.state.log = Object.assign({}, this.state.log)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user