Skip to content

[DONE] 커뮤니티 쪽이 Pattern Lab 코드 218 KB 를 뒤에서 받지 않는다 - #286

Merged
patternflow-bot merged 4 commits into
devfrom
claude/lsh-pf-round115-q954m5
Oct 26, 2026
Merged

patternflow-bot merged 4 commits into
devfrom
claude/lsh-pf-round115-q954m5

Conversation

@patternflow-bot

@patternflow-bot patternflow-bot commented Oct 26, 2026 •

Copy link
Copy Markdown

lsh / https://claude.ai/code/session_01YMV2HCJNqRjKp6Y9yQc549

커뮤니티 쪽을 열면 머리줄의 「Pattern Lab ↗」 이 Lab 코드 210.5 KB 를, 펌웨어 안내 띠의 「Pick an edition →」 이 editions 덩이 5.0 KB 를 쪽이 다 뜬 뒤에 받고 있었어요. 커뮤니티 밖으로 가는 링크 아홉이 미리 받지 않게 해서, 머지하면 커뮤니티 어느 쪽에서든 뜬 뒤에 오는 스크립트가 218.7 KB 에서 0 이 되고 Lab 은 링크를 누를 때 받아요.

좋아지는 것: 폰으로 커뮤니티만 둘러봐도 열지 않은 Lab 코드를 받지 않는다 — 쪽마다 219 KB 를 덜 쓴다

할 일

한 일

  • web/src/app/community/layout.tsx: 머리줄의 Pattern Lab 링크 둘(로그인 · 로그아웃)과 바닥의 「Terms & Privacy」 에 prefetch={false}.
  • web/src/components/community/FirmwareNotice.tsx: 「Pick an edition →」 에 prefetch={false}.
  • web/src/app/community/u/[username]/page.tsx, web/src/components/community/NotificationsList.tsx: 내 프로필과 빈 알림 쪽의 「Make & publish」 셋에 prefetch={false}.
  • web/src/components/community/AddHeaderModal.tsx: 헤더 창 글 속의 Pattern Lab 링크 둘에 prefetch={false}.
  • 새 시험 web/src/app/community/linkPrefetch.test.ts 는 app/community 와 components/community 의 <Link> 가운데 href 가 /community 밖으로 가는 것을 다 찾아 prefetch={false} 가 있는지 봐요. 앞으로 커뮤니티에 /guide 같은 링크가 들어와도 걸려요.
  • web/src/app/homeLinkPrefetch.test.ts 가 쓰던 sources 와 linkTags 를 web/test/linkTags.ts 로 옮겨 두 시험이 같이 써요. test/cssModules.ts 와 같은 자리예요. 그 시험이 보는 링크와 잣대는 그대로예요.

증거

Pi 와 같은 NEXT_PUBLIC_COMMUNITY_URL, NEXT_PUBLIC_BUILD_ENABLED 로 dev(66eec85)와 이 PR 을 빌드해, 같은 스크래치 DB(가입 ada 하나)로 띄웠어요. playwright-core 1.56.1 로 쪽마다 새 브라우저 문맥을 열고 load 뒤 8초를 기다린 다음 Resource Timing 에서 .js 를 셌어요. 크기는 받은 그대로(gzip)예요. 펌웨어 안내 띠는 새 브라우저라 다 떠 있어요.

쪽 (390 과 1440 이 같음)                     dev: load 뒤 스크립트           이 PR
/community                                   9개 218.7 KB (풀면 824,892)    0개 0 KB
/community/patterns                          9개 218.7 KB                   0개 0 KB
/community/decks                             8개 180.7 KB                   0개 0 KB
/community               (ada 로그인)        9개 218.7 KB                   0개 0 KB
/community/u/ada         (ada 로그인)        9개 218.7 KB                   0개 0 KB
/community/notifications (ada 로그인)        9개 218.7 KB                   0개 0 KB

/community 의 전체 스크립트                  20개 392.8 KB                  11개 174.1 KB
load 뒤에 미리 받은 쪽(RSC)                  /pattern-lab /editions /terms  커뮤니티 쪽만
                                             와 커뮤니티 쪽

dev 에서 load 뒤에 온 아홉 덩이를 .next/server/app/<쪽>/page_client-reference-manifest.js 로 가려 보면 일곱(210.5 KB)이 pattern-lab, 하나(5.0 KB)가 editions, 하나(3.2 KB)가 여러 쪽이 같이 쓰는 덩이예요. /community/decks 는 Lab 과 같이 쓰는 덩이 하나를 쪽을 열 때 이미 받아서 여덟이에요.

링크를 누르면 그대로 가요. 1440 에서 「Pattern Lab ↗」 에 마우스를 올려 1.5초 기다려도 스크립트는 11개 그대로였고, 누르니 773 ms 에 /pattern-lab(탭 「Pattern Lab / Patternflow」)이 떴어요. 「Pick an edition →」 은 583 ms 에 /editions(탭 「Firmware / Patternflow」)예요.

새 시험을 dev 의 링크로 돌렸을 때:

 ✓ links that leave the community > are still found
 × links that leave the community > skip the prefetch
   → expected [ …(9) ] to deeply equal []
   + "app/community/layout.tsx: href=\"/pattern-lab\"",
   + "app/community/layout.tsx: href=\"/pattern-lab\"",
   + "app/community/layout.tsx: href=\"/terms\"",
   + "app/community/u/[username]/page.tsx: href=\"/pattern-lab\"",
   + "app/community/u/[username]/page.tsx: href=\"/pattern-lab\"",
   + "components/community/AddHeaderModal.tsx: href=\"/pattern-lab\"",
   + "components/community/AddHeaderModal.tsx: href=\"/pattern-lab\"",
   + "components/community/FirmwareNotice.tsx: href=\"/editions\"",
   + "components/community/NotificationsList.tsx: href=\"/pattern-lab\"",
      Tests  1 failed | 1 passed (2)

고친 뒤:

 ✓ src/app/community/linkPrefetch.test.ts (2 tests)
 ✓ src/app/homeLinkPrefetch.test.ts (2 tests)

다섯 검사(web/ 에서, d5d0560 · 그 뒤 dev merge 는 incoming/ 만 바꿨어요):

npm ci                              → exit 0
npm run lint -- --max-warnings=0    → exit 0
npm run typecheck                   → exit 0
npm run build                       → ✓ Compiled successfully in 20.7s · exit 0
npm run check:ci                    → Test Files 114 passed (114) · Tests 1391 passed (1391)
                                      drift: passed 14, skipped 2 (links-absolute, roadmap) · exit 0
npm run check:voice                 → check:voice: nothing found (가지와 이 본문)

화면은 바뀌지 않아서 사진은 없어요. 고치기 전과 뒤의 scrollWidth 도 390 과 1440 그대로예요.

실행법

# web/ 에서
npx vitest run src/app/community/linkPrefetch.test.ts src/app/homeLinkPrefetch.test.ts
NEXT_PUBLIC_COMMUNITY_URL=http://localhost:3100 NEXT_PUBLIC_BUILD_ENABLED=1 npm run build
COMMUNITY_ENABLED=1 COMMUNITY_DB_PATH=<스크래치>/community.db BETTER_AUTH_SECRET=<아무 글> BETTER_AUTH_URL=http://localhost:3100 COMMUNITY_ALLOWED_ORIGINS=http://localhost:3100 npx next start -p 3100

브라우저 개발자 도구의 Network 를 JS 로 거르고 /community 를 열면, 쪽이 다 뜬 뒤에 더 오는 스크립트가 없어요.

가정

  • 「Terms & Privacy」 에도 prefetch={false} 를 붙였어요. 후보 줄의 고칠 곳에는 없고, 미리 받아도 덩이 없이 RSC 만 받아요. 그래도 시험의 잣대를 「커뮤니티 밖으로 가는 링크」 하나로 두면 뒤에 무거운 쪽 링크가 들어와도 시험이 잡아서 같이 넣었어요.
  • 헤더 창(AddHeaderModal)의 링크 둘도 후보 줄에 없지만, 창이 열리면 보이는 링크라 같은 잣대로 고쳤어요.
  • 빈 벽의 「Make & publish」(CommunityFeedClient.tsx)는 이미 <a> 라 미리 받지 않고, 패턴 쪽의 Lab 로 가기는 router.push 라 그대로 뒀어요.
  • prefetch={false} 는 Next 16 에서 화면에 들어올 때도 마우스를 올릴 때도 받지 않아요(node_modules/next/dist/docs/01-app/03-api-reference/02-components/link.md:304). 그래서 Lab 은 누른 뒤에 받아요. 위 773 ms 가 이 컨테이너에서 그 값이에요.
  • 표 밖: /community/decks 는 쪽을 열 때 Lab 과 같이 쓰는 덩이를 먼저 받아서 /community(174.1 KB)보다 33.8 KB 커요. 후보 26 이 같은 쪽을 다뤄서 손대지 않았어요.

Changelog

Web

  • Community pages no longer prefetch Pattern Lab. Every community page fetched 218.7 KB of script (gzip) after the load event: Pattern Lab's chunks through the header's Pattern Lab link, and the editions chunk through the firmware notice. Links that leave the community now load their page when they are followed.

경험

언제: 컨테이너에서 띄운 next start 를 멈추고 같은 줄에서 다시 빌드할 때
교훈: pkill -f "next start -p 3100" 은 그 글이 든 제 Bash 도 죽이니 pkill -f "[n]ext-server" 처럼 첫 글자를 대괄호로 싸요
근거: #286 에서 멈추기와 다시 빌드를 한 명령에 이으니 빌드가 돌기 전에 셸이 exit 144 로 끝났어요

바퀴

바퀴 115 · 후보 10 「커뮤니티 쪽이 Pattern Lab 코드 218 KB 를 뒤에서 받지 않는다」

다음 바퀴

  • 11위 「빌드 경로 둘이 이상한 몸과 이름에 500 이나 빈 200 대신 400 과 404 를 돌려주고, 처음 시험을 얻는다」: 몸 칸 하나를 [null] 로 바꾸면 CORS 없는 500 이 나요.
  • 12위 「로그인한 사람의 머리줄에 쪽을 열 때마다 「Sign in」 이 잠깐 뜨지 않는다」: AuthStatus 가 세션을 받아올 때까지 「Sign in」 을 그려요.
  • 13위 「펌웨어 안내 띠가 첫 그림부터 쪽에 있어서, 하이드레이션 뒤에 쪽 전체를 아래로 밀지 않는다」: 서버 쪽 값이 「닫음」 이라 띠가 하이드레이션 뒤에 끼어들어요.

https://claude.ai/code/session_01YMV2HCJNqRjKp6Y9yQc549


Generated by Claude Code

@patternflow-bot patternflow-bot changed the title [WIP] 바퀴 115 — 고를 일을 찾는 중 [WIP] 커뮤니티 쪽이 Pattern Lab 코드 218 KB 를 뒤에서 받지 않는다 Oct 26, 2026
@patternflow-bot patternflow-bot changed the title [WIP] 커뮤니티 쪽이 Pattern Lab 코드 218 KB 를 뒤에서 받지 않는다 [DONE] 커뮤니티 쪽이 Pattern Lab 코드 218 KB 를 뒤에서 받지 않는다 Oct 26, 2026
@patternflow-bot
patternflow-bot marked this pull request as ready for review October 26, 2026 16:33
@patternflow-bot
patternflow-bot merged commit abb811d into dev Oct 26, 2026
2 checks passed
@patternflow-bot
patternflow-bot deleted the claude/lsh-pf-round115-q954m5 branch October 26, 2026 16:35
engmung pushed a commit to engmung/Patternflow that referenced this pull request Oct 27, 2026
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