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
Overview
SubscriptionManager.tsx(619 lines, 11 touchables, no accessibility labels) andMobileSettings.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.MobileSettingsalready reaches foruseMemoin four places to compensate, which is the symptom rather than the fix: the sections should be separate memoised components. The repo hasSettingsSection.tsxandSettingsPicker.tsxfor exactly this purpose.Specifications
Features:
Tasks:
MobileSettings.tsxalong its existing visual sections usingSettingsSectionSubscriptionManager.tsxinto plan list, current-plan summary, and action componentsReact.memowith stable callbacksImpacted Files:
src/components/mobile/MobileSettings.tsxsrc/components/mobile/SubscriptionManager.tsxsrc/components/mobile/SettingsSection.tsxsrc/components/mobile/SettingsPicker.tsxAcceptance Criteria