diff --git a/app/stores/CommentsStore.ts b/app/stores/CommentsStore.ts index a8572f9ed9..8f0c410773 100644 --- a/app/stores/CommentsStore.ts +++ b/app/stores/CommentsStore.ts @@ -3,6 +3,7 @@ import compact from "lodash/compact"; import differenceBy from "lodash/differenceBy"; import keyBy from "lodash/keyBy"; import orderBy from "lodash/orderBy"; +import uniq from "lodash/uniq"; import { action, computed } from "mobx"; import Comment from "~/models/Comment"; import { CommentSortOption, CommentSortType } from "~/types"; @@ -50,7 +51,7 @@ export default class CommentsStore extends Store { const commentsById = keyBy(comments, "id"); const referencedComments = compact( - options.referencedCommentIds.map((id) => commentsById[id]) + uniq(options.referencedCommentIds.map((id) => commentsById[id])) ); const directComments = differenceBy(comments, referencedComments, "id"); diff --git a/app/types.ts b/app/types.ts index b280720ced..eb6e489397 100644 --- a/app/types.ts +++ b/app/types.ts @@ -217,8 +217,8 @@ export type Properties = { }; export enum CommentSortType { - MostRecent = "most_recent", - OrderInDocument = "order_in_document", + MostRecent = "mostRecent", + OrderInDocument = "orderInDocument", } export type CommentSortOption =