Skip to content

[Bug] SettingRow right prop callback recreated on every parent render — breaks PureComponent optimization #626

Description

@RUKAYAT-CODER

Overview

src/components/mobile/SettingRow.tsx receives an onPress or right render prop that is defined as an inline arrow function in the parent settings screen. Because the parent re-renders on any store state change (theme, user, network), a new function reference is created each time. SettingRow is a pure component (React.memo) but the unstable onPress reference defeats the memo check and causes unnecessary re-renders for every row in the settings list.

Specifications

Features:

  • All onPress handlers in settings screens wrapped with useCallback
  • SettingRow props are stable across parent re-renders that don't change setting values
  • Re-render confirmed absent on unrelated store changes via Profiler

Tasks:

  • Audit the parent settings screen(s) for inline onPress functions
  • Wrap each with useCallback with correct dependency array
  • Verify SettingRow has React.memo wrapping
  • Add profiler test confirming SettingRow does not re-render on unrelated parent state change

Impacted Files:

  • Settings screen component(s) in src/pages/mobile/ or src/components/mobile/
  • src/components/mobile/SettingRow.tsx

Acceptance Criteria

  • onPress handler reference is stable across parent re-renders
  • SettingRow does not re-render when unrelated store state changes
  • Profiler confirms 0 re-renders for settings rows on theme toggle
  • All useCallback dependency arrays are correct (no missing deps)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programbugSomething isn't workingperformancePerformance issue or optimization

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions