From 48ff0ad84bbf0be3e12ab480d8aa7ba89b3eabc2 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 24 Oct 2024 09:45:20 -0400 Subject: [PATCH] fix: Duplicate threads in sidebar when comment mark crosses boundary --- app/stores/CommentsStore.ts | 3 ++- app/types.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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 =