Skip to content

bug: widespread key={index} on lists that have stable identifiers #424

Description

@nanaf6203-bit

Summary

Lists in many components use key={index} for items that already have stable identifiers.

Affected area

  • src/components/mobile/OfflinePropertyCache.tsx (cached properties — has id)
  • src/components/mobile/MobilePropertyViewer.tsx (thumbnails)
  • src/components/mobile/MobilePropertyCard.tsx (badges)
  • src/components/property/ImageLightbox.tsx
  • src/components/audit/TransactionAuditTrail.tsx
  • src/components/search/SearchHistoryDropdown.tsx
  • src/components/LoadingSpinner.tsx
  • src/components/security/WalletAddressInput.tsx (errors/warnings)
  • src/components/responsive/ImagePlaceholder.tsx
  • src/components/responsive/LazyLoadingExample.tsx
  • src/components/TransactionConfirmation.tsx / src/components/SecureTransactionConfirmation.tsx
  • src/components/dashboard/\*

Steps to reproduce / impact

When the underlying list changes (filter change, delete item, reorder), React destroys and rebuilds DOM nodes, losing focus and animation state. Image lightboxes flicker. Loading states lose progress.

Expected behaviour

Use a stable identifier (id, hash, src, …) as the key wherever one exists. Resort to key={index} only as a last resort for lists with no inherent identity.

Acceptance criteria

  • Replace key={index} in all the files above with stable identifiers.
  • Add a lint rule (or comment) prohibiting key={index} for elements that have a meaningful id.
  • Open a follow-up tracking remaining offenders.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't working correctlypriority/p2P2 — medium priorityrefactorCode health / refactor (no behaviour change)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions