Skip to content

Commit

Permalink
do not rely on reference equality
Browse files Browse the repository at this point in the history
  • Loading branch information
gbalint committed Jan 5, 2024
1 parent 685cf3f commit 13fe817
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion editor/src/components/inspector/sections/comment-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { canvasPointToWindowPoint } from '../../canvas/dom-lookup'
import { CommentRepliesCounter } from '../../canvas/controls/comment-replies-counter'
import type { SelectOption } from '../controls/select-control'
import { assertNever } from '../../../core/shared/utils'
import { pluck } from '../../../core/shared/array-utils'

export type CommentFilterMode = 'all' | 'all-including-resolved' | 'unread-only'

Expand Down Expand Up @@ -104,7 +105,8 @@ const ThreadPreviews = React.memo(() => {
case 'all-including-resolved':
return threads
case 'unread-only':
return threads.filter((t) => !readThreads.includes(t))
const readThreadIds = pluck(readThreads, 'id')
return threads.filter((t) => !readThreadIds.includes(t.id))
default:
assertNever(commentFilterMode)
}
Expand Down

0 comments on commit 13fe817

Please sign in to comment.