Skip to content

fix(dystopia): refresh author lists and feed comment counts after writes - #1550

Merged
panicboat merged 1 commit into
mainfrom
fix/dystopia-reply-render
Oct 17, 2026
Merged

panicboat merged 1 commit into
mainfrom
fix/dystopia-reply-render

Conversation

@panicboat

Copy link
Copy Markdown
Owner

Closes #1507

Why

書き込み後にリロードしないと表示が更新されない箇所が残っていた。

  • プロフィールの「投稿」「メディア」「返信」タブ: SWR 2.5.1 は述語で mutate すると $inf$ key(useSWRInfinite)をスキップする(config-context-*.mjs の !/^\$(inf|sub)\$/.test(key))。そのため投稿作成時の述語 mutate が届かず、コメント追加・削除後はそもそも mutate されていなかった
  • フィードのカードのコメント数: フィードは SWR の外で投稿を持つため、詳細シートでコメントしても数が変わらなかった

投稿詳細のコメント・返信の再取得は #1545 で unstable_serialize による key 指定に変わり、修正済み。

What

  • modules/post/lib/revalidate.ts: karte の revalidate.ts と同じ形の refresh 登録の仕組み。useAuthorPosts / useAuthorComments が登録し、投稿作成・コメント追加・コメント削除のあとに revalidatePostLists() を呼ぶ
  • stores/postCommentCountStore.ts: usePost が取得したコメント数を記録し、PostCardBinding は store の値があればそれを優先する(いいね数の postLikeStore と同じ形)

Verification

  • pnpm exec vitest run: 184 files / 778 tests passed(新規 postListRefresh.test.tsx、PostCardBinding.commentsCount.test.tsx、PostComposerSheet.test.tsx への追加を含む)
  • pnpm exec tsc --noEmit: exit 0

🤖 Generated with Claude Code

https://claude.ai/code/session_01DA9qTtJtm2tPquKk7hyPR5

SWR's matcher mutate skips useSWRInfinite keys, so the profile posts/media
and replies tabs kept stale pages until a reload after posting or
commenting. Author list hooks now register their refresh in a post-module
registry (same shape as the karte one) that the composer and comment
hooks call after writing.

Feed lists hold posts outside SWR, so a card's comment count stayed stale
after commenting in the detail sheet. usePost now records the fetched
count in a store that PostCardBinding prefers over its prop.

Claude-Session: https://claude.ai/code/session_01DA9qTtJtm2tPquKk7hyPR5
Signed-off-by: panicboat <panicboat@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3f5afc68-8f5e-4913-9697-b1770e32e9ff
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@panicboat-github-workflow-bot panicboat-github-workflow-bot Bot added the deploy:frontend Auto-generated deployment label label Oct 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Kustomize Diff

Service: frontend
Environment: production

No changes

@panicboat
panicboat added this pull request to stack #1552 October 17, 2026 07:02
@panicboat
panicboat marked this pull request as ready for review October 17, 2026 11:35
@panicboat
panicboat merged commit 3d98ebe into main Oct 17, 2026
13 checks passed
@panicboat
panicboat deleted the fix/dystopia-reply-render branch October 17, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy:frontend Auto-generated deployment label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: 投稿の返信などがリロードしないと描画されない

1 participant