Description
SettingsCategoryScreen.kt is a single 3,037-line composable that collects 18 StateFlows at its top level and dispatches to 12+ category sections in a when block. Any state change in any collected flow (directory explorer, sync progress, palette regeneration) recomposes the entire settings screen.
Additionally, the system prompt editor and AI usage report sections are duplicated between the AI_INTEGRATION and GENERATION_PARAMETERS categories.
Location
app/src/main/java/com/theveloper/pixelplay/presentation/screens/SettingsCategoryScreen.kt
Expected Behavior
Each settings category should be a separate composable that only collects the StateFlows it needs, reducing recomposition scope. Shared sections (system prompt, usage report) should be extracted into reusable composables.
Actual Behavior
The entire settings screen recomposes on any state change, even if the change is unrelated to the visible category. Duplicated code increases maintenance burden.
Fix
- Extract each category into its own
@Composable function
- Move category-specific state collection into each sub-composable
- Extract shared sections (system prompt editor, usage report) into reusable composables
- Pass only the necessary state as parameters
Description
SettingsCategoryScreen.ktis a single 3,037-line composable that collects 18 StateFlows at its top level and dispatches to 12+ category sections in awhenblock. Any state change in any collected flow (directory explorer, sync progress, palette regeneration) recomposes the entire settings screen.Additionally, the system prompt editor and AI usage report sections are duplicated between the
AI_INTEGRATIONandGENERATION_PARAMETERScategories.Location
app/src/main/java/com/theveloper/pixelplay/presentation/screens/SettingsCategoryScreen.ktExpected Behavior
Each settings category should be a separate composable that only collects the StateFlows it needs, reducing recomposition scope. Shared sections (system prompt, usage report) should be extracted into reusable composables.
Actual Behavior
The entire settings screen recomposes on any state change, even if the change is unrelated to the visible category. Duplicated code increases maintenance burden.
Fix
@Composablefunction