- CatalogSearchOverlay: replace handleAddStub with real openAddToCollection/openAddToThread routing based on catalogSearchMode - ConfirmDialog + __root.tsx: swap t() for Trans component on deleteItemMessage, deleteCandidateMessage, pickWinnerMessage — fixes <bold> rendering as literal text - Biome format pass: fix 23 lint/format errors across scripts, services, tests - Planning: mark all UAT and verification gaps resolved for phases 07, 11, 16, 20, 21, 22, 24, 32, 34; close debug sessions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.4 KiB
status, trigger, created, updated
| status | trigger | created | updated |
|---|---|---|---|
| resolved | Client-side error 'can't access property id, w[0] is undefined' occurs after login | 2026-04-08T00:00:00Z | 2026-04-08T00:00:00Z |
Current Focus
hypothesis: CONFIRMED — AddToThreadModal.tsx has an unguarded activeThreads[0].id in a useEffect dependency array, which throws when there are no active threads (new user after login) test: Root cause confirmed by code reading expecting: Fix by replacing activeThreads[0].id with activeThreads[0]?.id in the dependency array next_action: Apply fix
Symptoms
expected: After login, app loads normally and shows user's collection actual: Error thrown client-side: "can't access property 'id', w[0] is undefined" errors: "can't access property 'id', w[0] is undefined" — minified variable name, from production/built bundle reproduction: Happens after logging in (OIDC via Logto) started: Unclear when it started, user noticed it now
Eliminated
-
hypothesis: Bug is in auth hooks or route guards evidence: useAuth.ts and __root.tsx are clean — auth handles null/undefined safely timestamp: 2026-04-08T00:00:00Z
-
hypothesis: Bug is in categories[0].id access in CreateThreadModal, ManualEntryForm, or AddToCollectionModal evidence: All three guard with
categories && categories.length > 0before accessing [0].id timestamp: 2026-04-08T00:00:00Z
Evidence
- timestamp: 2026-04-08T00:00:00Z
checked: AddToThreadModal.tsx lines 62-68
found: useEffect dependency array evaluates
activeThreads[0].idunconditionally. When activeThreads is empty (new user after login with no threads), this throws TypeError. implication: This is the root cause. The guardactiveThreads.length === 0inside the effect body does NOT protect the dependency array itself — React evaluates the dep array on every render.
Resolution
root_cause: In AddToThreadModal.tsx, the useEffect dependency array at lines 62-68 directly accesses activeThreads[0].id without optional chaining. When a user logs in with no active threads (empty array), React evaluates this expression during render and throws "can't access property 'id', w[0] is undefined".
fix: Replace activeThreads[0].id with activeThreads[0]?.id in the useEffect dependency array
verification: Fix applied — changed activeThreads[0].id to activeThreads[0]?.id in useEffect dependency array. This prevents the TypeError when activeThreads is empty.
files_changed: [src/client/components/AddToThreadModal.tsx]