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.
📌 관련 이슈번호
✅ Key Changes
FollowerPage
UI 구현 (UserProfile
+FollowerList
컴포넌트로 구성 )SSR
,CSR
구분UserProfile
컴포넌트의 데이터는ssr
로 데이터를 처리 ( 데이터를 처음 받아온 이후로 동적으로 바뀌지 않음 )UserList
컴포넌트의 데이터는 처음에는ssr
로 데이터를 처리하고 이후 데이터를csr
로 처리 (팔로우 언팔로우 기능에 따라서 데이터가 동적으로 변하기 때문)next
에서 제공하는Image
컴포넌트를 사용할 때 이슈가 발생먼저 우리가 생성한
next page router
프로젝트에서는 기본적으로react 18
버전이다,react 18
버전에서는fetchPriority
라는 속성을 제공한다고 공식 문서에 나와있다.next js
레포에서도image
컴포넌트에서fetchPriority
라는 속성을 사용하고 있다돌고돌아
react
레포에 가보니 우리가 사용하는18
버전에서 이런 버그가 있었다공식 문서에는 fetchPriority 속성을 제공한다고 나와있지만, 실제로 제공이 되지 않고 있었던 것이다.
그래서 나온 해결책은 react의 버전을 업그레이드 하는것, 또는 fetchPriority속성을 사용하지 않는 다른 image 컴포넌트를 사용하는 것이었다
next js
공식문서에 들어가보니next/Image
로 업그레이드 되기 전 컴포넌트를(next/legacy/Image
) 제공하고 있었다.해당 컴포넌트는
fetchPriority
속성 대신 자체적으로priority
라는 속성을 만들어서? 사용하는것 같다.. 그래서 해당 문제를 해결할 수 있었다.(별 문제가 없다면 react 버전을 업그레이드 하는것도 좋은 방법일듯)
next
에서 제공하는Image
컴포넌트를 사용할 때priority
이슈찾아보니
LCP
는웹 성능 측정 지표 중 하나로, 사용자가 페이지 로딩 시 가장 큰 콘텐츠 요소가 화면에 렌더링되는 데 걸리는 시간을 측정한다
라고 나와있다내가 사용한 이미지가
LCP
로next
에 의해서detecting
되었고, 화면 렌더링을 최적화 하기 위해priority
속성을 사용하여 브라우저가 우선적으로 로드하게 하는것이다. 공식 문서에서도LCP
로detecting
된Image
는priority
속성을 꼭 사용하라고 나와있다📢 To Reviewers
📸 스크린샷
soomsims.mov
Reference
<!— 참고한 사이트가 있다면 링크를 공유해주세요. —>
https://mingeesuh.tistory.com/entry/Next-JS-13-%EC%A0%81%EC%9A%A9%ED%95%B4%EB%B3%B4%EA%B8%B0-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EB%B6%88%EB%9F%AC%EC%98%A4%EA%B8%B0-Data-Fetching-%ED%8E%B8
https://19.react.dev/reference/react-dom/components/script#props
facebook/react#25682
https:/vercel/next.js/blob/canary/packages/next/src/client/legacy/image.tsx
https://nextjs.org/docs/pages/api-reference/components/image-legacy#priority