--- phase: 35-bug-fixes plan: "01" subsystem: client tags: [bug-fix, modal, types, auth, thread, login] dependency_graph: requires: [] provides: - thread-add-candidate-wired-to-catalog-search - item-with-category-image-fields - login-redirect-immediate affects: - src/client/routes/threads/$threadId/index.tsx - src/client/hooks/useItems.ts - src/client/routes/login.tsx tech_stack: added: [] patterns: - "useUIStore selector per action (openCatalogSearch, setCatalogSessionThreadId)" - "Immediate useEffect redirect for server-handled auth routes" key_files: created: [] modified: - src/client/routes/threads/$threadId/index.tsx - src/client/hooks/useItems.ts - src/client/routes/login.tsx decisions: - "FIX-01: Add Candidate routes through CatalogSearchOverlay in thread mode, not a local modal" - "FIX-02: ItemWithCategory type extended client-side only — server already returns all fields" - "FIX-04: Login page is a pass-through; client renders no UI beyond a brief loading indicator" metrics: duration: "~15 minutes" completed: "2026-04-19T17:42:45Z" tasks_completed: 3 tasks_total: 3 --- # Phase 35 Plan 01: Type/Wiring Bug Fixes Summary **One-liner:** Wire thread Add Candidate to CatalogSearchOverlay, expose image fields on ItemWithCategory, and replace login card UI with immediate server redirect. ## Tasks Completed | Task | Name | Commit | Files | |------|------|--------|-------| | 1 | Wire Add Candidate button, delete AddCandidateModal | 7fca929 | src/client/routes/threads/$threadId/index.tsx | | 2 | Extend ItemWithCategory with image fields | b43a932 | src/client/hooks/useItems.ts | | 3 | Replace login page UI with useEffect redirect | 053d562 | src/client/routes/login.tsx | ## What Was Built **FIX-01 — Thread Add Candidate button wired correctly** The toolbar "Add Candidate" button on thread detail pages was calling `setAddCandidateOpen(true)`, opening a local `AddCandidateModal` form that duplicated the CatalogSearchOverlay functionality. The button now calls `setCatalogSessionThreadId(threadId)` + `openCatalogSearch("thread")`, routing through the existing overlay. The entire `AddCandidateModal` component (~300 lines) was deleted along with its unused imports (`useCreateCandidate`, `useCurrency`, `ImageUpload`, `CategoryPicker`). **FIX-02 — ItemWithCategory type now includes image and currency fields** The `ItemWithCategory` interface was missing six fields that the server already returns via `withImageUrls()`: `imageUrl`, `dominantColor`, `cropZoom`, `cropX`, `cropY`, `priceCurrency`. Adding them to the interface unblocks collection overview cards from receiving typed image data for display. **FIX-04 — Login page is a lean pass-through** The old login page rendered a full card UI with a sign-in button. Since `/login` on the server immediately issues a Logto OIDC redirect, no client-side auth check or UI is needed. The page now renders only "Signing in..." and immediately navigates to `/login` via `useEffect`. ## Deviations from Plan None — plan executed exactly as written. ## Verification - `grep -n "addCandidateOpen" src/client/routes/threads/$threadId/index.tsx` → 0 matches - `grep -n "AddCandidateModal" src/client/routes/threads/$threadId/index.tsx` → 0 matches - `grep -n "openCatalogSearch" src/client/routes/threads/$threadId/index.tsx` → 2 matches - All 6 image/currency fields present in `ItemWithCategory` - `wc -l src/client/routes/login.tsx` → 18 lines - `bun run lint` → 0 errors (1 warning in unrelated script file) - `bun test` → 464 pass, 0 fail ## Known Stubs None. ## Self-Check: PASSED - 7fca929 exists: confirmed - b43a932 exists: confirmed - 053d562 exists: confirmed - src/client/routes/threads/$threadId/index.tsx: exists, modified - src/client/hooks/useItems.ts: exists, modified - src/client/routes/login.tsx: exists, modified (18 lines)