Skip to content

[DONE] 머리줄의 알림 수가 알림 쪽을 열면 사라지고, 쪽에 보이지 않는 알림은 세지 않는다 - #285

Merged
patternflow-bot merged 4 commits into
devfrom
claude/pf-round-114-txkdu4
Oct 26, 2026
Merged

patternflow-bot merged 4 commits into
devfrom
claude/pf-round-114-txkdu4

Conversation

@patternflow-bot

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

Copy link
Copy Markdown

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

커뮤니티 머리줄의 Alerts 수를 알림 목록과 같은 줄로 세고, 알림 쪽이 읽음 처리를 마치면 쪽을 새로 그리게 했어요. 머지하면 「Alerts 3」 이 알림 쪽을 여는 순간 「Alerts」 로 바뀌고 Patterns 로 가도 다시 뜨지 않아요. 비공개가 된 패턴이나 걷어 낸 워크숍의 알림처럼 목록에 없는 알림은 더 세지 않아서, 빈 알림 쪽 위에 「Alerts 2」 가 뜨는 일도 없어요.

좋아지는 것: 알림을 읽으면 머리줄 수가 바로 사라진다 — 새로 고침하지 않아도 되고, 열어 볼 수 없는 알림은 세지 않는다

한 일

  • web/src/lib/community/server/queries/notifications.ts: 거르기를 shownTo() 하나로 옮겼어요. 비공개가 된 남의 패턴 · 덱, 지워진 대상, 워크숍 post 알림을 SQL 에서 빼고, 운영자는 비공개 대상의 알림을 그대로 받아요. 지금까지 목록이 JS 에서 하던 것과 같은 조건이에요. countUnreadNotifications 와 listNotifications 가 같은 조인(PATTERN_TARGET, DECK_TARGET)과 이 조건을 써요. 세기는 moderator 를 받고, 목록은 거른 뒤에 50개를 잘라요(전엔 50개를 자른 뒤 걸러서 50개보다 적게 보일 수 있었어요).
  • web/src/app/community/layout.tsx: 세기에 { moderator: isAdmin } 를 넘겨요.
  • web/src/components/community/NotificationsList.tsx: 읽음 POST 의 답이 ok 이고 들어올 때 안 읽은 줄이 있었으면 router.refresh() 를 불러요. 레이아웃이 다시 세서 수가 사라져요. 그 사이 다른 쪽으로 옮겼으면 그 쪽에서 사라져요. 401 이나 네트워크 오류면 수를 그대로 둬요. 새로 그리면 목록이 다 읽은 줄로 돌아오니, 들어올 때 안 읽었던 줄(unreadOnArrival)은 이 방문 동안 표시를 지켜요. POST 는 한 방문에 한 번이에요.
  • 시험 둘을 더했어요. queries/notifications.test.ts 는 스크래치 DB 에서 진짜 댓글 경로와 편집 경로를 돌려요. bea 가 ada 의 공개 패턴에 댓글을 달고, ada 가 그 패턴을 비공개로 돌린 뒤 답을 달면 bea 의 수와 목록이 둘 다 0, 워크숍 알림을 하나 남겨도 0, 운영자로 읽으면 둘 다 1 · 2, 다시 공개하면 1 인지 봐요. NotificationsList.test.tsx 는 POST 의 답이 오기 전엔 refresh 가 없고 답이 오면 한 번, 401 과 네트워크 오류엔 없고, 새로 그린 뒤에도 안 읽었던 줄이 표시를 지키는지 봐요.

증거

폰 390 · ada 가 Alerts 를 누른 뒤 · 고친 뒤
폰 390 · ada 가 Alerts 를 누른 뒤 · 고치기 전
폰 390 · bea 의 알림 쪽 · 고친 뒤
폰 390 · bea 의 알림 쪽 · 고치기 전
데스크톱 1440 · ada 가 Alerts 를 누른 뒤 · 고친 뒤

Pi 와 같은 NEXT_PUBLIC_COMMUNITY_URL, NEXT_PUBLIC_BUILD_ENABLED 로 빌드하고 스크래치 DB 에 HTTP 로 넣었어요. ada, bea, cal 이 가입하고, ada 가 「Tide」 와 「Harbour」 를 공개로 올려요. bea 가 Tide 에, cal 과 bea 가 Harbour 에 댓글을 달아요. ada 가 Harbour 를 비공개로 돌리고 거기 답을 달아요. 그래서 ada 는 알림 셋, bea 는 남이 비공개로 돌린 Harbour 의 알림 하나예요. bea 에겐 26일 전에 쌓인 워크숍 알림 하나를 DB 에 바로 넣었어요. playwright-core 1.56.1 로 로그인한 뒤 /community 를 열고 머리줄의 Alerts 링크를 눌러 3초를 기다렸어요. Patterns 와 뒤로 가기도 다 클라이언트 이동이에요. 한 번 돌 때마다 read_at 을 비워 같은 상태에서 시작했어요. 고치기 전은 같은 DB 를 복사해 dev 의 네 파일로 다시 빌드해서 쟀어요.

                                   dev                                  이 PR
ada  /community                    "Alerts 3"                           "Alerts 3"
ada  Alerts 누르고 3초             "Alerts 3" · 줄 3, 표시 3            "Alerts" · 줄 3, 표시 3
ada  Patterns 누름                 "Alerts 3"                           "Alerts"
ada  뒤로 가기(알림 쪽)            "Alerts 3"                           "Alerts"
bea  /community                    "Alerts 2"                           "Alerts"
bea  Alerts 누르고 3초             "Alerts 2" · 줄 0                    "Alerts" · 줄 0

390(isMobile, hasTouch)과 1440 이 같았어요. 가로 넘침은 다 390/390, 1440/1440 이에요.

새 시험을 dev 의 파일로 돌렸을 때:

 × stops counting an alert once its pattern goes private, as the page stops listing it
   → expected { badge: 1, unread: +0 } to deeply equal { badge: +0, unread: +0 }
 × does not count a workshop alert, which has nowhere left to link
   → expected { badge: 2, unread: +0 } to deeply equal { badge: +0, unread: +0 }
 × counts the pattern's alerts again once it is public again
      Tests  3 failed | 1 passed (4)

 × refreshes once the server has marked the alerts read
 × keeps the rows that were unread highlighted after the refresh, and marks read once
      Tests  2 failed | 3 passed (5)

고친 뒤:

 ✓ src/lib/community/server/queries/notifications.test.ts (4 tests)
 ✓ src/components/community/NotificationsList.test.tsx (5 tests)

다섯 검사(web/ 에서, 4d437e6):

npm ci                              → exit 0
npm run lint -- --max-warnings=0    → exit 0
npm run typecheck                   → exit 0
npm run build                       → ✓ Compiled successfully in 15.0s · exit 0
npm run check:ci                    → Test Files 113 passed (113) · Tests 1389 passed (1389)
                                      drift: passed 14, skipped 2 (links-absolute, roadmap) · exit 0
npm run check:voice                 → check:voice: nothing found

실행법

# web/ 에서
npx vitest run src/lib/community/server/queries/notifications.test.ts src/components/community/NotificationsList.test.tsx
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

알림이 있는 계정으로 로그인해 /community 의 「Alerts N」 을 누르면 몇 초 안에 「Alerts」 가 되고, Patterns 로 가도 그대로예요.

가정

  • 읽음 POST 는 전처럼 늘 보내요. 새로 그리기는 들어올 때 안 읽은 줄이 있었을 때만이에요. 수가 이제 목록과 같은 줄을 세서, 안 읽은 줄이 없으면 지울 수도 없어요.
  • 「Alerts 1」 이 알림 쪽에서도 남던 건 지금 주석이 말한 대로 「다음 서버 그림」을 기다려서인데, 같은 레이아웃 아래 이동은 레이아웃을 다시 그리지 않아요. 그래서 레이아웃이 아니라 알림 목록이 끝난 뒤 새로 그리기를 불러요. Next 16 의 router.refresh() 는 useState 를 지켜서 표시가 남아요(node_modules/next/dist/docs/01-app/03-api-reference/04-functions/use-router.md:46).
  • 운영자의 수도 목록처럼 비공개 대상 알림을 세요. 레이아웃이 이미 isAdmin 을 읽고 있어서 더 읽는 것은 없어요.
  • 표 밖: 읽음 POST 는 그 순간의 안 읽은 줄을 다 읽음으로 돌려요. 쪽을 그린 뒤 POST 전에 온 알림도 읽음이 돼서 표시 없이 목록에 나와요. 고치려면 POST 가 「어디까지 봤는지」 를 받아야 해서 경로를 바꾸는 일이라 그대로 뒀어요.
  • 표 밖: 목록은 50개까지예요. 안 읽은 알림이 50개를 넘으면 수가 목록보다 커요. 지금 쌓이는 양에선 닿지 않아요.

Changelog

Web

  • The community's Alerts badge clears once you have read your alerts, and counts only the ones you can open. The header counted once per full page load, so "Alerts 3" stayed on the alerts page and on every page after it until a reload. It also counted alerts on patterns that had since gone private and on the retired workshop, which the alerts page never lists, so a member could see "Alerts 2" over an empty page.

경험

언제: 커뮤니티 레이아웃(머리줄)에 서버가 읽은 값을 바꾸는 일을 할 때
교훈: 같은 레이아웃 아래 클라이언트 이동은 레이아웃을 다시 그리지 않으니, 값을 바꾼 쪽이 서버 답을 받은 뒤 router.refresh() 를 부르고 지켜야 할 화면 상태는 useState 에 둬요
근거: #285 에서 dev 의 「Alerts 3」 은 알림 쪽, Patterns, 뒤로 가기에서 다 그대로였고, 읽음 POST 뒤 refresh 를 부르자 세 곳 다 「Alerts」 가 됐어요

바퀴

바퀴 114 · 후보 9 「머리줄의 알림 수가 알림 쪽을 열면 사라지고, 쪽에 보이지 않는 알림은 세지 않는다」

다음 바퀴

  • 10위 「커뮤니티 쪽이 Pattern Lab 코드 218 KB 를 뒤에서 받지 않는다」: 머리의 /pattern-lab Link 가 Lab 덩이 여덟을 미리 받아요.
  • 11위 「빌드 경로 둘이 이상한 몸과 이름에 500 이나 빈 200 대신 400 과 404 를 돌려주고, 처음 시험을 얻는다」: {patterns:[null]} 이 CORS 없는 500, ?file=__proto__ 가 빈 200 이에요.
  • 12위 「로그인한 사람의 머리줄에 쪽을 열 때마다 「Sign in」 이 잠깐 뜨지 않는다」: AuthStatus 가 세션을 받아올 때까지 「Sign in」 을 그려서 폰 머리줄이 두 줄이었다가 줄어요.

https://claude.ai/code/session_01Y1tPTKaaeeyktG13KvmFsx


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y1tPTKaaeeyktG13KvmFsx
@patternflow-bot patternflow-bot changed the title [WIP] 바퀴 114 — 고를 일을 찾는 중 [WIP] 머리줄의 알림 수가 알림 쪽을 열면 사라지고, 쪽에 보이지 않는 알림은 세지 않는다 Oct 26, 2026
… they are read

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y1tPTKaaeeyktG13KvmFsx
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y1tPTKaaeeyktG13KvmFsx
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y1tPTKaaeeyktG13KvmFsx
@patternflow-bot patternflow-bot changed the title [WIP] 머리줄의 알림 수가 알림 쪽을 열면 사라지고, 쪽에 보이지 않는 알림은 세지 않는다 [DONE] 머리줄의 알림 수가 알림 쪽을 열면 사라지고, 쪽에 보이지 않는 알림은 세지 않는다 Oct 26, 2026
@patternflow-bot
patternflow-bot marked this pull request as ready for review October 26, 2026 16:00
@patternflow-bot
patternflow-bot merged commit 66eec85 into dev Oct 26, 2026
2 checks passed
@patternflow-bot
patternflow-bot deleted the claude/pf-round-114-txkdu4 branch October 26, 2026 16:02
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