Skip to content

perf: optimize next/image sizes with dynamic maxWidth (#1089)#1222

Merged
MODSetter merged 1 commit intoMODSetter:devfrom
oscarzhou511:perf/issue-1089-image-sizes
Apr 14, 2026
Merged

perf: optimize next/image sizes with dynamic maxWidth (#1089)#1222
MODSetter merged 1 commit intoMODSetter:devfrom
oscarzhou511:perf/issue-1089-image-sizes

Conversation

@oscarzhou511
Copy link
Copy Markdown
Contributor

@oscarzhou511 oscarzhou511 commented Apr 14, 2026

This PR ensures that next/image sizes are optimized by using dynamic maxWidth.

Description

  • Updated surfsense_web/components/tool-ui/image/index.tsx to use dynamic sizes values based on the maxWidth prop for both auto-ratio and fixed-ratio images.
  • Verified that features-bento-grid.tsx uses responsive sizes matching its grid column widths: (max-width: 768px) 100vw, (max-width: 1024px) 50vw, 33vw.
  • Verified that mdx-components.tsx includes a sensible default for Markdown images: (max-width: 768px) 100vw, 896px.

Motivation and Context

FIX #1089 - modifying next/image sizes use dynamic maxWidth

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual verification: Confirmed the dynamic generation of the sizes attribute correctly reflects the maxWidth prop.

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

Hopefully this helps the SurfSense project ;)
Oscar

High-level PR Summary

This PR optimizes the next/image component's responsive image loading by replacing hardcoded sizes attributes with dynamic values based on the maxWidth prop. The changes ensure that both auto-ratio and fixed-ratio images generate appropriate size hints for the browser, improving image loading performance and reducing unnecessary bandwidth usage.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_web/components/tool-ui/image/index.tsx

Need help? Join our Discord

Analyze latest changes

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

@oscarzhou511 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on e1e4bb4..0bdc081

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (1)

surfsense_web/components/tool-ui/image/index.tsx

@MODSetter MODSetter merged commit 91c2c06 into MODSetter:dev Apr 14, 2026
1 of 2 checks passed
@oscarzhou511
Copy link
Copy Markdown
Contributor Author

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants