Repository navigation
feat(chat): improve shared chats opengraph image - #2426
Conversation
WalkthroughThe PR adds OpenGraph image preview support to the share endpoint by extracting image URLs from message data and refactoring the OG rendering into reusable text and image layout components. It also suppresses the share dialog in the chat header during comparison mode. ChangesOpenGraph image preview rendering
ChatHeader comparison mode UI
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/playground/src/app/share/[shareId]/opengraph-image.tsx (1)
424-424: 💤 Low valueConsider using non-null assertion for type clarity.
Since
ImagePreviewonly renders whenpreview.imageUrlis truthy (Line 501), the nullish coalescing to empty string is defensive but creates an impossible state wheresrc="". Consider usingpreview.imageUrl!or asserting non-null in the component signature for better type safety.♻️ Clearer type expression
-function ImagePreview({ preview }: { preview: SharePreview }) { +function ImagePreview({ preview }: { preview: SharePreview & { imageUrl: string } }) { return ( <div style={{ ... - src={preview.imageUrl ?? ""} + src={preview.imageUrl}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/playground/src/app/share/`[shareId]/opengraph-image.tsx at line 424, Replace the defensive nullish-coalescing src assignment with a non-null assertion to reflect that ImagePreview only renders when preview.imageUrl is truthy: locate the ImagePreview rendering and change the src prop usage from preview.imageUrl ?? "" to using preview.imageUrl! (or update the ImagePreview prop type to require a non-null imageUrl) so the component type reflects the guaranteed presence of the URL and avoids an impossible src="" state.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/playground/src/app/share/`[shareId]/opengraph-image.tsx:
- Line 424: Replace the defensive nullish-coalescing src assignment with a
non-null assertion to reflect that ImagePreview only renders when
preview.imageUrl is truthy: locate the ImagePreview rendering and change the src
prop usage from preview.imageUrl ?? "" to using preview.imageUrl! (or update the
ImagePreview prop type to require a non-null imageUrl) so the component type
reflects the guaranteed presence of the URL and avoids an impossible src=""
state.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1fa8cc15-77cb-46b2-936a-96881f15c826
📒 Files selected for processing (2)
apps/playground/src/app/share/[shareId]/opengraph-image.tsxapps/playground/src/components/playground/chat-header.tsx
Summary by CodeRabbit
New Features
Bug Fixes