-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(profile-pics): remove sharp depenencey for serving profile pics in settings #2199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 comments
| alt={profile?.name || 'User'} | ||
| width={36} | ||
| height={36} | ||
| unoptimized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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