fix(profile-pics): remove sharp depenencey for serving profile pics in settings#2199
fix(profile-pics): remove sharp depenencey for serving profile pics in settings#2199waleedlatif1 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryDisabled Next.js image optimization for profile pictures in settings modal by adding the
The change unconditionally disables optimization for all profile pictures. The codebase has similar avatar components ( Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant SettingsModal
participant ProfilePictureUpload
participant Image as Next.js Image
participant API as /api/files/upload
User->>SettingsModal: Click profile picture
SettingsModal->>ProfilePictureUpload: handleThumbnailClick()
ProfilePictureUpload->>User: Open file picker
User->>ProfilePictureUpload: Select image file
ProfilePictureUpload->>ProfilePictureUpload: validateFile()
ProfilePictureUpload->>ProfilePictureUpload: createObjectURL()
ProfilePictureUpload->>Image: Display preview
Note over Image: unoptimized=true<br/>(bypasses sharp)
ProfilePictureUpload->>API: Upload to server
API-->>ProfilePictureUpload: Return server URL
ProfilePictureUpload->>ProfilePictureUpload: revokeObjectURL()
ProfilePictureUpload->>Image: Display uploaded image
Note over Image: Renders without<br/>Next.js optimization
|
| alt={profile?.name || 'User'} | ||
| width={36} | ||
| height={36} | ||
| unoptimized |
There was a problem hiding this comment.
style: Unconditionally disabling optimization means all images (including local ones) bypass Next.js optimization. Consider conditionally applying unoptimized based on URL:
| unoptimized | |
| unoptimized={imageUrl?.startsWith('http')} |
This matches the pattern used in user-avatar.tsx:58 and avatars.tsx:65.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/settings-modal/components/general/general.tsx
Line: 294:294
Comment:
**style:** Unconditionally disabling optimization means all images (including local ones) bypass Next.js optimization. Consider conditionally applying `unoptimized` based on URL:
```suggestion
unoptimized={imageUrl?.startsWith('http')}
```
This matches the pattern used in `user-avatar.tsx:58` and `avatars.tsx:65`.
How can I resolve this? If you propose a fix, please make it concise.| alt={formData.name || 'Profile picture'} | ||
| width={36} | ||
| height={36} | ||
| unoptimized |
There was a problem hiding this comment.
style: Unconditionally disabling optimization means all images (including local ones) bypass Next.js optimization. Consider conditionally applying unoptimized based on URL:
| unoptimized | |
| unoptimized={profilePictureUrl?.startsWith('http')} |
This matches the pattern used in other avatar components like user-avatar.tsx:58.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/settings-modal/components/template-profile/template-profile.tsx
Line: 351:351
Comment:
**style:** Unconditionally disabling optimization means all images (including local ones) bypass Next.js optimization. Consider conditionally applying `unoptimized` based on URL:
```suggestion
unoptimized={profilePictureUrl?.startsWith('http')}
```
This matches the pattern used in other avatar components like `user-avatar.tsx:58`.
How can I resolve this? If you propose a fix, please make it concise.
Summary
Type of Change
Testing
Tested manually
Checklist