fix(case-page): resolve full-page review findings (bugs + RTL + resilience) #329

Merged
chaim merged 1 commits from worktree-case-page-fixes into main 2026-06-20 18:58:21 +00:00
Owner

סקירת-קוד מלאה של דף-התיק (14 רכיבים, ~4,000 שורות) — כל הממצאים תוקנו כאן.

באגי-לוגיקה

  • case-edit-dialogform.reset רץ ב-poll כל-5ש' בזמן שהדיאלוג פתוח → דרס עריכות. עכשיו מאפס רק ב-open→true.
  • status-changerselected לא הסתנכרן ל-currentStatus אסינכרוני/חיצוני (dropdown תקוע). שוכתב לעקוב אחרי currentStatus עד בחירה מפורשת; מתאפס אחרי שמירה.
  • decision-blocks-panelblock.content/word_count ללא הגנת-null (אין response-model) → קריסת-render אפשרית; coerce ?? ""/?? 0. STATUS_LABELS עם fallback לסטטוס במקום undefined.
  • document-type-editorawait mutateAsync() בלי try/catch → unhandled rejection. עוטף (שגיאות עדיין דרך isError).

עמידות / היגיינה

  • page.tsx — 5xx חולף ב-poll הפיל את כל הדף ומחק נתונים טעונים. עכשיו מגודר ב-!data + כפתור "נסה שוב".
  • cases.ts useUpdateCase — invalidate ל-all דרס את ה-patch האופטימי של ה-detail. צומצם ל-prefix של list.

תקינות-RTL (מאפיינים לוגיים)

mr-automs-auto/me-auto, אייקונים ml-1/ml-2me-1/me-2, * חובה mr-1ms-1, רשימה pr-4ps-4 (agent-status-widget, agent-activity-feed, document-type-editor).

מינוריים

<a href>next/link (drafts-panel) · issueMap ב-useMemo · aria-label ל-Textarea · upload-sheet: unknown כבר לא ✓ ירוק (אייקון ניטרלי + "רענן לאישור") · citations.ts: case_name: string | null.

שער-עיצוב

פריטים נוגעי-ויזואל (צד-ה-gap ב-RTL, כפתור "נסה שוב", אייקון-העלאה ניטרלי) אושרו ע"י היו"ר דרך אישור הממצאים ("לתקן הכול"); אף אחד לא משנה layout של עמוד-מאושר — תיקוני-תקינות בלבד.

בדיקות

tsc --noEmit נקי · eslint נקי (אזהרת form.watch קיימת-מראש בשורה לא-נגועה).

אומת תקין בסקירה (ללא שינוי)

אין double-card נוסף · אין שימוש-שגוי ב-TanStack v5 · אין בליעת-שגיאות שקטה · drafts-panel/app-shell נקיים כמעט לגמרי.

🤖 Generated with Claude Code

סקירת-קוד מלאה של **דף-התיק** (14 רכיבים, ~4,000 שורות) — כל הממצאים תוקנו כאן. ## באגי-לוגיקה - **case-edit-dialog** — `form.reset` רץ ב-poll כל-5ש' בזמן שהדיאלוג פתוח → דרס עריכות. עכשיו מאפס רק ב-open→true. - **status-changer** — `selected` לא הסתנכרן ל-`currentStatus` אסינכרוני/חיצוני (dropdown תקוע). שוכתב לעקוב אחרי currentStatus עד בחירה מפורשת; מתאפס אחרי שמירה. - **decision-blocks-panel** — `block.content`/`word_count` ללא הגנת-null (אין response-model) → קריסת-render אפשרית; coerce `?? ""`/`?? 0`. `STATUS_LABELS` עם fallback לסטטוס במקום `undefined`. - **document-type-editor** — `await mutateAsync()` בלי try/catch → unhandled rejection. עוטף (שגיאות עדיין דרך `isError`). ## עמידות / היגיינה - **page.tsx** — 5xx חולף ב-poll הפיל את **כל הדף** ומחק נתונים טעונים. עכשיו מגודר ב-`!data` + כפתור "נסה שוב". - **cases.ts** `useUpdateCase` — invalidate ל-`all` דרס את ה-patch האופטימי של ה-detail. צומצם ל-prefix של list. ## תקינות-RTL (מאפיינים לוגיים) `mr-auto`→`ms-auto`/`me-auto`, אייקונים `ml-1/ml-2`→`me-1/me-2`, `*` חובה `mr-1`→`ms-1`, רשימה `pr-4`→`ps-4` (agent-status-widget, agent-activity-feed, document-type-editor). ## מינוריים `<a href>`→`next/link` (drafts-panel) · issueMap ב-`useMemo` · `aria-label` ל-Textarea · upload-sheet: `unknown` כבר לא ✓ ירוק (אייקון ניטרלי + "רענן לאישור") · citations.ts: `case_name: string | null`. ## שער-עיצוב פריטים נוגעי-ויזואל (צד-ה-gap ב-RTL, כפתור "נסה שוב", אייקון-העלאה ניטרלי) **אושרו ע"י היו"ר** דרך אישור הממצאים ("לתקן הכול"); אף אחד לא משנה layout של עמוד-מאושר — תיקוני-תקינות בלבד. ## בדיקות `tsc --noEmit` נקי · `eslint` נקי (אזהרת `form.watch` קיימת-מראש בשורה לא-נגועה). ## אומת תקין בסקירה (ללא שינוי) אין double-card נוסף · אין שימוש-שגוי ב-TanStack v5 · אין בליעת-שגיאות שקטה · drafts-panel/app-shell נקיים כמעט לגמרי. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chaim added 1 commit 2026-06-20 18:58:13 +00:00
fix(case-page): resolve full-page review findings (bugs + RTL + resilience)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 4s
Lint — undefined names / undefined-names (pull_request) Successful in 10s
2b591f5018
Full code review of the case-detail page (14 components) surfaced these,
all fixed here:

Logic bugs
- case-edit-dialog: form.reset ran on the 5s useCase refetch while the dialog
  was open, clobbering in-progress edits. Now resets only on open→true.
- status-changer: `selected` never synced to async/external `currentStatus`
  (stale dropdown). Reworked to track currentStatus until an explicit pick;
  resets to tracking after save.
- decision-blocks-panel: `block.content`/`word_count` accessed without null
  guards (endpoint has no response model) → potential render crash. Coerced
  with `?? ""` / `?? 0`. `STATUS_LABELS[status]` now falls back to the raw
  status instead of rendering literal "undefined".
- document-type-editor: `await mutateAsync()` in async click handlers without
  try/catch → unhandled promise rejection. Wrapped (errors still surface via
  isError).

Resilience / hygiene
- page.tsx: a transient 5xx on the background poll flipped the WHOLE page to
  the error card and discarded loaded data. Now gated on `!data`, plus a
  "נסה שוב" retry.
- cases.ts useUpdateCase: invalidated casesKeys.all, which re-invalidated the
  detail it had just optimistically patched. Scoped to the list prefix.

RTL correctness (logical properties)
- agent-status-widget `mr-auto`→`ms-auto`; agent-activity-feed `mr-auto`→
  `me-auto`, icon `ml-1/ml-2`→`me-1/me-2`, required `*` `mr-1`→`ms-1`;
  document-type-editor list `pr-4`→`ps-4`.

Minors
- drafts-panel: `<a href>`→`next/link` (operations + citation links) for SPA
  nav. agent-activity-feed: issueMap memoized; comment Textarea aria-label.
  upload-sheet: `unknown` status no longer shown as green success (neutral
  icon + "רענן לאישור"). citations.ts: case_name typed `string | null`.

Design gate: visual-touching items (RTL gap side, retry button, neutral
upload icon) were chair-authorized via the reviewed-findings approval ("fix
all"); none alter an approved page layout — they are correctness fixes.
tsc clean; eslint clean (1 pre-existing form.watch warning, untouched line).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chaim merged commit b57cd17408 into main 2026-06-20 18:58:21 +00:00
chaim deleted branch worktree-case-page-fixes 2026-06-20 18:58:21 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ezer-mishpati/legal-ai#329