fix: Prompt editor deletes content below truncation in long prompts#5528
fix: Prompt editor deletes content below truncation in long prompts#5528
Conversation
Replace string truncation (appending "...") with CSS line-clamp for visual truncation. This prevents the truncation marker from being treated as actual content when editing or saving prompts. Fixes issue where long prompts would have content deleted below the truncation point when editing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Claude finished @chitalian's task —— View job Code Review Completed ✅Todo List:
Code Review ResultsScore: 8/10 - Good fix, ready to merge with minor considerations AnalysisThis PR addresses a critical bug where string-based truncation was corrupting prompt content during editing. The solution correctly switches from JavaScript string manipulation to CSS-only visual truncation. ✅ Strengths
Code Changes Reviewweb/components/templates/prompts/id/promptChatRow.tsx:376-496 Before: const displayText = isMinimized ? `${text.substring(0, 100)}...` : text;
// Later: displayText.replace(...) - modifying truncated contentAfter: // Always use full text to avoid truncation bugs - use CSS for visual truncation
const displayText = isStatic ? text.replace(...) : text;
// Wrap in: <div className={isMinimized ? "line-clamp-3" : ""}>🟡 Minor Considerations
Suggestions Summary
Security & Performance
The fix correctly addresses the root cause and follows React/CSS best practices. The implementation is clean and maintains consistency across both code paths. |
Summary
substring(0, 100) + "...") with CSS-based truncation (line-clamp-3)Problem
When entering a long system prompt and making edits above the "..." truncation marker, the content below the truncation would be removed and "..." would become part of the actual prompt content.
Solution
Use CSS
line-clamp-3class for visual truncation instead of modifying the underlying text. This ensures:Test plan
🤖 Generated with Claude Code