[4팀 정한슬] Chapter 4-1 성능최적화: SSR, SSG, Infra - #32
Open
hanseul524 wants to merge 14 commits into
Open
hanseul524 wants to merge 14 commits into
hanseul524 wants to merge 14 commits into
Conversation
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.
과제 체크포인트
배포 링크
기본과제 (Vanilla SSR & SSG)
Express SSR 서버
<!--app-html-->,<!--app-head-->)서버 사이드 렌더링
클라이언트 Hydration
window.__INITIAL_DATA__스크립트 주입Static Site Generation
심화과제 (React SSR & SSG)
React SSR
renderToString서버 렌더링React Hydration
Static Site Generation
아하! 모먼트 (A-ha! Moment)
CSR - SSR - SSG: 언제 HTML을 만드는가!
simple ssr 코드를 클론받아서 블로그 설명과 함께 단계별로 진행하면서 CSR - SSR - SSG 의 기본적인 흐름을 익힐 수 있었습니다. 제가 느끼기엔 기본 - 심화 - 초심화 같은 느낌의 과제였습니다. 처음에 simple ssr은 간단해서 흐름 파악하기도 쉽고 어떤 시점에 생성되는지 .. 이런것들을 이해했다고 생각하고 과제로 넘어왔는데 이해한게 아니었다는 것을 알게되었습니다 ..^^..
CSR
SSR
SSG
Hydration: 서버와 클라이언트의 상태 동기화
이번 과제에서 가장 신기했던 개념이 Hydration이었습니다. 제가 경험해보지 못한 새로운 개념이었습니다.
Hydration = 서버와 클라이언트의 상태 동기화JSP에서는 서버와 클라이언트가 완전히 분리된 세계였습니다. 서버는 HTML을 만들고, 클라이언트는 그걸 받아서 표시하고, 필요하면 다시 요청. Modern SSR에서는 서버와 클라이언트가 같은 상태를 공유합니다:Hydraiton의 핵심은 서버가 만든 HTML은 그대로 유지하고, 이벤트만 붙이는것 이라고 생각했습니다.
Router 분리
각 렌더링 방식은 실행 환경과 실행 시점이 다르기 때문에 구분을 해주어야 하고 처음에 전역 상태로 두었는데 이게 나중에 큰 업보가 되어서 돌아왔습니다. 쩝 ..
Router를 다 사용하니 전역에 두고 구분해서 호출해주면 된다고 생각했는데 이런 상태를 전역로 두면 데이터가 섞이고 실행 환경마다 생명주기가 달라 생성해줘야 하는 시점이 그때 그때 다르다는 걸 꺠달았습니다. 처음에 정리가 잘 되지 않아서 콘솔에 로그를 남발해서 언제 요청 하고, 언제 생성해주는지 확인했습니다ㅠㅠ자유롭게 회고하기
JSP 환경에서는
session,request객체가 자동으로 격리됨트러블 슈팅 (겁나 많은 ...)
express 버전 호환성 문제
-> 모든 시점에 디버깅을 해보다가 Express 문제인걸 확인했습니다.
Store 주입 패턴에 대한 문제
다 구현후에 E2E 테스트를 자신만만하게 돌렸는데 띨롱 .. 다 실패해버리는 크나큰 문제가 있었습니다. 그 중 구조적인 문제로
main-server.js에 작성했던 코드들이었습니다. 컴포넌트가 전역store를 참조하도록 작성했는데, SSR은 요청별로 독립적인store가 필요합니다.페이지 컴포넌트가
store를 파라미터로 받도록 수정해서 SSR은 서버 store를 주입하고 CSR은 파라미터 없이 호출하게 되어 전역store를 사용하도록 했습니다.리뷰 받고 싶은 내용
Q1. SSG 라우팅 문제
router가main-server.js에서 import 되는 시점에 이미 생성되어서BASE_URL이 그 시점에 결정되어서 자꾸 상세페이지 -> 홈페이지로 보내는 문제가 있었습니다ㅠㅠ 그래서static-site-generate.js에서 강제로 먼저 경로를 설정하도록 했는데 이방향이 틀린것 같아서 더 좋은 방법이 있을까요?