feat(web): utilize image dimensions for CLS prevention (#141)#144
Merged
Conversation
- Add imageWidth/imageHeight to PostGridItem and FeedCardItem types - Map image_width/image_height from Supabase and REST API in useImages.ts - FeedClient passes dimensions through to FeedCardItem - FeedCard sets container aspect ratio from DB dimensions (fallback: none) - SavedGrid extracts SavedGridItemCard using useImageDimensions hook for aspect ratio - RelatedLooksSection/GallerySection accept width/height on image types, use style.aspectRatio with fallback height classes - MasonryGridItem derives aspectRatio from image_width/image_height when aspectRatio field absent - GridItemData type extended with image_width/image_height optional fields Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…aspectRatio PostImage container now uses DB dimensions to set aspectRatio, eliminating letterbox margins and matching the image's natural ratio. Works in both dynamic (blur bg + object-contain) and fallback modes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Switch from fill mode to width/height props so container height flows naturally from image ratio, capped by maxHeight. - Image fits → no blur visible (container matches image exactly) - Image exceeds maxHeight → object-contain + blur fills gaps - Browser pre-reserves space from width/height → zero CLS Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
getBlurSrc was wrapping image-proxy URL inside /_next/image optimizer which rejected local API URLs with query params. Simplified to use image-proxy directly for external URLs — CSS background-image doesn't need Next.js optimization and the browser caches the full image anyway. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DB의
image_width/image_height값을 활용하여 CLS(Cumulative Layout Shift) 개선.PostImage 핵심 변경 (Reddit-style)
fill모드 →width/heightprops 기반으로 전환maxHeight로 제한object-contain+ 블러 배경/_next/image이중 프록시 →image-proxy직접 사용)컴포넌트별 변경
imageWidth/imageHeightprops 추가, Reddit-style 레이아웃useImageDimensions훅 활용image_width/image_heightfallback 체인style.aspectRatio(fallback 유지)PostGridItem에 dimension 필드 추가모든 컴포넌트에 null dimension fallback 유지 (기존 레이아웃 호환).
Test plan
tsc --noEmit통과🤖 Generated with Claude Code