Skip to content

[Optimization] SubscriptionManager.tsx (619 lines) and MobileSettings.tsx (609 lines) should be split by section #996

Description

@RUKAYAT-CODER

Overview

SubscriptionManager.tsx (619 lines, 11 touchables, no accessibility labels) and MobileSettings.tsx (609 lines, 13 type errors) are both monolithic screens holding many independent sections in one component. Any state change — a toggle, a fetch completing, a modal opening — re-renders the whole tree. MobileSettings already reaches for useMemo in four places to compensate, which is the symptom rather than the fix: the sections should be separate memoised components. The repo has SettingsSection.tsx and SettingsPicker.tsx for exactly this purpose.

Specifications

Features:

  • Each settings/subscription section extracted into its own memoised component
  • State ownership pushed down to the section that uses it
  • Accessibility labels added during the split

Tasks:

  • Split MobileSettings.tsx along its existing visual sections using SettingsSection
  • Split SubscriptionManager.tsx into plan list, current-plan summary, and action components
  • Wrap each extracted section in React.memo with stable callbacks
  • Add render-count assertions so a toggle repaints one section only

Impacted Files:

  • src/components/mobile/MobileSettings.tsx
  • src/components/mobile/SubscriptionManager.tsx
  • src/components/mobile/SettingsSection.tsx
  • src/components/mobile/SettingsPicker.tsx

Acceptance Criteria

  • Toggling one setting re-renders only its section
  • No file in either tree exceeds ~250 lines
  • Both screens have full accessibility labelling

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions