Skip to content

[Bug] FlatList missing keyExtractor on notification and bookmark lists — triggers React key warnings #674

Description

@RUKAYAT-CODER

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions