Overview
Multiple FlatList instances across the app (notifications, bookmarks, search results) render without a keyExtractor prop, or with one that returns item.id?.toString() where id may be undefined for optimistically-added items. React Native falls back to array index as key, causing incorrect animation and update behavior on insert, remove, and reorder.
Specifications
Features:
- All FlatList instances have explicit
keyExtractor returning stable unique string
- Optimistically-added items assigned client-side UUID as temporary key
- No fallback to array index under any condition
Tasks:
- Audit all
FlatList and SectionList components across src/components/
- Add
keyExtractor={(item) => item.id.toString()} to each
- For optimistic items, assign
id: 'temp-${Date.now()}-${Math.random().toString(36).slice(2)}' at creation
- Add ESLint custom rule or note to require
keyExtractor on all list components
- Add unit test asserting stable key prop on rendered list items
Impacted Files:
src/components/mobile/MobileNotifications.tsx
- Bookmark and search result list components
Acceptance Criteria
- No React key warning in dev console for any list component
- Optimistic items have stable non-index keys
- Item animation correct on insert, delete, and reorder
- Code review checklist updated to verify keyExtractor presence
Overview
Multiple
FlatListinstances across the app (notifications, bookmarks, search results) render without akeyExtractorprop, or with one that returnsitem.id?.toString()whereidmay beundefinedfor optimistically-added items. React Native falls back to array index as key, causing incorrect animation and update behavior on insert, remove, and reorder.Specifications
Features:
keyExtractorreturning stable unique stringTasks:
FlatListandSectionListcomponents acrosssrc/components/keyExtractor={(item) => item.id.toString()}to eachid: 'temp-${Date.now()}-${Math.random().toString(36).slice(2)}'at creationkeyExtractoron all list componentsImpacted Files:
src/components/mobile/MobileNotifications.tsxAcceptance Criteria