perf(home): stop popular threads rerenders after load

This commit is contained in:
Tommaso Casaburi
2026-04-19 15:01:27 +07:00
parent 508fffe5d6
commit 4b06ac8c9a
7 changed files with 249 additions and 17 deletions
@@ -0,0 +1,29 @@
{
"task": "popular-threads-rerenders",
"last_updated": "2026-04-19",
"items": [
{
"id": "F001",
"priority": 1,
"status": "completed",
"description": "Reduce unnecessary rerenders in the popular threads box after the popular-thread algorithm finishes and the loaded list is stable until hard refresh.",
"verification": [
"./scripts/agent-init.sh --smoke",
"profile popular threads rerender behavior with react-scan",
"yarn build",
"yarn lint",
"yarn type-check",
"yarn doctor",
"playwright-cli browser checks across Blink, Gecko, and WebKit"
],
"files": [
"src/hooks/use-current-time.ts",
"src/hooks/use-popular-posts.ts",
"src/hooks/__tests__/browser-hooks.test.tsx",
"src/views/home/popular-threads-box/popular-threads-box.tsx",
"src/views/home/popular-threads-box/__tests__/popular-threads-box.test.tsx"
],
"notes": "Post-fix profile measured 0 React commits and no PopularThreadsBox/PopularThreadCard/CatalogPostMedia/ContentPreview rerenders in the 10s window after Popular Threads became visible."
}
]
}
@@ -0,0 +1,21 @@
# Progress Log
Append one entry per session.
## 2026-04-19 00:00
- Item: F001
- Summary: Created a fresh worktree and initialized task tracking before profiling the popular threads rerender issue.
- Files: `docs/agent-runs/popular-threads-rerenders/feature-list.json`, `docs/agent-runs/popular-threads-rerenders/progress.md`
- Verification: pending
- Blockers: none
- Next: Run baseline smoke check, profile the affected views, identify the popular threads source components, then implement the scoped rerender fix.
## 2026-04-19 14:56
- Item: F001
- Summary: Detached Popular Threads from feed-state and community subscriptions after the popular-post cache is revealed, and disabled timer updates for frozen current-time consumers.
- Files: `src/hooks/use-current-time.ts`, `src/hooks/use-popular-posts.ts`, `src/hooks/__tests__/browser-hooks.test.tsx`, `src/views/home/popular-threads-box/popular-threads-box.tsx`, `src/views/home/popular-threads-box/__tests__/popular-threads-box.test.tsx`
- Verification: `./scripts/agent-init.sh --smoke` with branch-scoped `AGENT_APP_URL`, `yarn test`, targeted Vitest files, `yarn build`, `yarn lint`, `yarn type-check`, `yarn doctor`, `yarn knip`, pre/post profile-browsing runs, `playwright-cli` desktop and mobile checks in Chrome, Firefox, and WebKit
- Blockers: none
- Next: Review and commit the completed task branch.