fix(comments): replace optimistic updates with loading state

- Remove temp-xxx optimistic inserts from submitComment/submitReply
- Wait for API response, then insert real comment into timeline
- Add Loader2 spinner to comment/reply submit buttons during loading
- Remove hover card from Markdown.tsx (will be handled via NodeView later)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Naiyuan Qing 2026-03-31 16:03:13 +08:00
parent b9ea10c89d
commit 98829fad29
4 changed files with 15 additions and 47 deletions

View file

@ -3,7 +3,6 @@ import ReactMarkdown, { type Components } from 'react-markdown'
import rehypeRaw from 'rehype-raw'
import remarkGfm from 'remark-gfm'
import { cn } from '@/lib/utils'
import { MentionHoverCard } from '@/components/common/mention-hover-card'
import { CodeBlock, InlineCode } from './CodeBlock'
import { preprocessLinks } from './linkify'
@ -61,15 +60,10 @@ function createComponents(
a: ({ href, children }) => {
// Mention links: mention://member/id or mention://agent/id
if (href?.startsWith('mention://')) {
const parts = href.replace('mention://', '').split('/')
const mentionType = parts[0] ?? 'member'
const mentionId = parts[1] ?? ''
return (
<MentionHoverCard type={mentionType} id={mentionId}>
<span className="text-primary font-semibold mx-0.5">
{children}
</span>
</MentionHoverCard>
<span className="text-primary font-semibold mx-0.5">
{children}
</span>
)
}