Files
SubMiner/backlog/tasks/task-205 - Address-PR-19-Claude-frontend-review-follow-ups.md

4.1 KiB

id, title, status, assignee, created_date, updated_date, labels, milestone, dependencies, references, priority
id title status assignee created_date updated_date labels milestone dependencies references priority
TASK-205 Address PR #19 Claude frontend review follow-ups Done
codex
2026-03-20 02:41 2026-03-20 02:46
m-1
stats/src/components/vocabulary/VocabularyTab.tsx
stats/src/hooks/useSessions.ts
stats/src/hooks/useTrends.ts
medium

Description

Assess Claude's latest PR #19 review, apply any valid frontend fixes from that review batch, and verify the stats dashboard behavior stays unchanged aside from the targeted performance and error-handling improvements.

Acceptance Criteria

  • #1 VocabularyTab avoids recomputing expensive known-word and summary aggregates on unrelated rerenders while preserving current displayed values.
  • #2 useSessions and useSessionDetail normalize rejected values into stable string errors without throwing from the catch handler.
  • #3 Targeted tests cover the addressed review items and pass locally.
  • #4 Any user-facing docs remain accurate after the changes.

Implementation Plan

  1. Add focused tests that fail on the current branch for the two valid Claude findings: render-time aggregate recomputation in VocabularyTab and unsafe non-Error rejection handling in useSessions/useSessionDetail.
  2. Update VocabularyTab to memoize the expensive summary and known-word aggregate calculations off the existing filteredWords/kanji/knownWords inputs without changing rendered values.
  3. Normalize hook error handling to convert unknown rejection values into stable strings, matching the existing useTrends pattern.
  4. Run the targeted stats/frontend test lane, verify no docs changes are needed, and record results in task notes.

Implementation Notes

Validated Claude's latest PR #19 review comment from 2026-03-20 and narrowed it to two valid frontend follow-ups: memoized VocabularyTab aggregates and non-Error-safe session hook error handling.

Added focused regression tests in stats/src/lib/vocabulary-tab.test.ts and stats/src/hooks/useSessions.test.ts before patching the implementation.

Verification: cd stats && bun test src/lib/vocabulary-tab.test.ts src/hooks/useSessions.test.ts passed; bun run format:check:stats passed.

Project-native verifier (.agents/skills/subminer-change-verification/scripts/verify_subminer_change.sh --lane core ...) passed root bun run typecheck and failed at bun run test:fast due an unrelated existing failure in scripts/update-aur-package.test.ts (mapfile: command not found). Artifact: .tmp/skill-verification/subminer-verify-20260319-194525-vxVD9V.

No user-facing docs changes were needed because the fixes only affect render-time memoization and error normalization.

Final Summary

Assessed Claude's latest PR #19 review and applied the two valid follow-ups. stats/src/components/vocabulary/VocabularyTab.tsx now memoizes buildVocabularySummary(filteredWords, kanji) and the known-word count so unrelated rerenders do not rescan the filtered vocabulary list. stats/src/hooks/useSessions.ts now exports a small toErrorMessage helper and uses it in both useSessions and useSessionDetail, preventing .catch() handlers from throwing when a promise rejects with a non-Error value.

Added targeted regressions in stats/src/lib/vocabulary-tab.test.ts and stats/src/hooks/useSessions.test.ts to lock in the memoization shape and error normalization behavior. Verification passed for cd stats && bun test src/lib/vocabulary-tab.test.ts src/hooks/useSessions.test.ts and bun run format:check:stats. The repo-native verification wrapper for the classified core lane also passed root bun run typecheck, but bun run test:fast is currently blocked by an unrelated existing failure in scripts/update-aur-package.test.ts (mapfile: command not found); artifacts are recorded under .tmp/skill-verification/subminer-verify-20260319-194525-vxVD9V.