Skip to content
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

[FE] Creator Image Lazy loading 적용 #795

Merged
merged 5 commits into from
Oct 24, 2024
Merged

[FE] Creator Image Lazy loading 적용 #795

merged 5 commits into from
Oct 24, 2024

Conversation

jinhokim98
Copy link
Contributor

issue

구현 사항

Creator 이미지 Lazy loading 적용

Creator 이미지도 필요할 때 불러오도록 lazy loading했습니다.
여기에는 Intersection Observer를 달지 않았습니다.

여기 이미지는 특정 공간이 관측될 때 가져와야 하는 이미지가 8개 입니다.
지금 훅은 이미지 한 개만 지원하고 있어서 배열을 지원하는 훅도 만들어야 합니다.

하지만 제작자 이미지들은 페이지 제일 하단에 있어 loading lazy를 주어도 충분히 초기 로딩 때 이미지를 불러오지 않았기 때문에 img 태그에 loading lazy만 적용했습니다.

lazy loading (Intersection Observer) fallback src도 지원

webp와 png 둘 다 lazy loading이 되도록 훅에서 기능을 추가했습니다

type ImgTagSrcType = string | undefined;

const [imageSrc, setImageSrc] = useState<ImgTagSrcType>(undefined);
const [fallbackImageSrc, setFallbackImageSrc] = useState<ImgTagSrcType>(undefined);

🫡 참고사항

@jinhokim98 jinhokim98 added 🖥️ FE Frontend 🚧 refactor refactoring labels Oct 23, 2024
@jinhokim98 jinhokim98 added this to the v2.1.3 milestone Oct 23, 2024
@jinhokim98 jinhokim98 requested review from pakxe, soi-ha and Todari October 23, 2024 12:37
@jinhokim98 jinhokim98 self-assigned this Oct 23, 2024
Copy link

@jinhokim98 jinhokim98 linked an issue Oct 23, 2024 that may be closed by this pull request
2 tasks
Copy link
Contributor

@soi-ha soi-ha left a comment

Choose a reason for hiding this comment

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

오호~ lazy 적용 좋아요!
쿠키 pr보고 든 생각인데 나중에 createor 이미지들은 은행 아이콘들 하나에 모아둔 것처럼 바꿔도 좋을 것 같네요!

@jinhokim98
Copy link
Contributor Author

https://www.toptal.com/developers/css/sprite-generator

image sprite 기법을 도움 받을 수 있는 사이트입니다!

Copy link
Contributor

@Todari Todari left a comment

Choose a reason for hiding this comment

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

고생했어요~!~! 나이스십니당

Copy link

@Todari Todari merged commit bbc7d89 into fe-dev Oct 24, 2024
2 checks passed
@Todari Todari deleted the feature/#794 branch October 24, 2024 09:11
@Todari Todari mentioned this pull request Oct 24, 2024
Todari pushed a commit that referenced this pull request Oct 24, 2024
* feat: fallback src도 lazy loading을 지원하도록 변경

* feat: fallback src 적용

* feat: lazy loading을 적용하여 초기 로딩 시 아바타 이미지 불러오지 않게 설정

* style: 이미지 url 유틸 함수 사용
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖥️ FE Frontend 🚧 refactor refactoring
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[FE] Creator Image Lazy loading 적용
3 participants