Skip to content

Conversation

@own-boldsbrain
Copy link
Member

Summary

  • implement persistent CommentThread component with @mentions, editing, deletion, and resolve controls
  • add tests for comment CRUD operations and resolution filtering

Testing

  • pnpm exec biome lint apps/web/components/canvas/CommentThread.tsx
  • pnpm exec vitest run apps/web/components/canvas/__tests__/CommentThread.test.tsx --environment jsdom
  • pnpm lint (fails: repository lint errors)

https://chatgpt.com/codex/tasks/task_e_68ba4fc63f3483329f4d84fa562186d2

Copilot AI review requested due to automatic review settings September 5, 2025 02:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Implements a persistent CommentThread component with full CRUD operations, @mention support, thread resolution controls, and localStorage persistence.

  • Adds complete comment lifecycle management (create, read, update, delete)
  • Implements @mention highlighting and thread resolution/filtering functionality
  • Adds comprehensive test coverage for comment operations and thread state management

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
package.json Adds testing dependencies (@testing-library/react, @testing-library/user-event, jsdom)
apps/web/components/canvas/tests/CommentThread.test.tsx New test file covering CRUD operations and thread resolution filtering
apps/web/components/canvas/CommentThread.tsx Complete rewrite adding persistence, editing, deletion, @mentions, and resolution controls
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +120 to +130
t.split(/(@\w+)/g).map((part) =>
part.startsWith('@') ? (
<span
key={`mention-${part}-${nanoid()}`}
className="text-blue-600"
data-testid="mention"
>
{part}
</span>
) : (
<span key={`text-${part}-${nanoid()}`}>{part}</span>
Copy link

Copilot AI Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using nanoid() in render functions creates new IDs on every render, causing unnecessary re-renders. Use the part content or index as the key instead.

Suggested change
t.split(/(@\w+)/g).map((part) =>
part.startsWith('@') ? (
<span
key={`mention-${part}-${nanoid()}`}
className="text-blue-600"
data-testid="mention"
>
{part}
</span>
) : (
<span key={`text-${part}-${nanoid()}`}>{part}</span>
t.split(/(@\w+)/g).map((part, idx) =>
part.startsWith('@') ? (
<span
key={`mention-${part}-${idx}`}
className="text-blue-600"
data-testid="mention"
>
{part}
</span>
) : (
<span key={`text-${part}-${idx}`}>{part}</span>

Copilot uses AI. Check for mistakes.
Comment on lines +120 to +130
t.split(/(@\w+)/g).map((part) =>
part.startsWith('@') ? (
<span
key={`mention-${part}-${nanoid()}`}
className="text-blue-600"
data-testid="mention"
>
{part}
</span>
) : (
<span key={`text-${part}-${nanoid()}`}>{part}</span>
Copy link

Copilot AI Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using nanoid() in render functions creates new IDs on every render, causing unnecessary re-renders. Use the part content or index as the key instead.

Suggested change
t.split(/(@\w+)/g).map((part) =>
part.startsWith('@') ? (
<span
key={`mention-${part}-${nanoid()}`}
className="text-blue-600"
data-testid="mention"
>
{part}
</span>
) : (
<span key={`text-${part}-${nanoid()}`}>{part}</span>
t.split(/(@\w+)/g).map((part, idx) =>
part.startsWith('@') ? (
<span
key={`mention-${part}-${idx}`}
className="text-blue-600"
data-testid="mention"
>
{part}
</span>
) : (
<span key={`text-${part}-${idx}`}>{part}</span>

Copilot uses AI. Check for mistakes.
{comments.map((c) => (
<li key={c.id} className="text-sm">
<span className="font-medium">{c.author}</span>: {c.text}
<li key={c.id} className="text-sm flex gap-2" >
Copy link

Copilot AI Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space before the closing bracket in the className prop.

Suggested change
<li key={c.id} className="text-sm flex gap-2" >
<li key={c.id} className="text-sm flex gap-2">

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants