Skip to content

Bug: SettingsCategoryScreen is a 3,037-line monolith collecting 18 StateFlows #60

Description

@daedaevibin

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

  1. Extract each category into its own @Composable function
  2. Move category-specific state collection into each sub-composable
  3. Extract shared sections (system prompt editor, usage report) into reusable composables
  4. Pass only the necessary state as parameters

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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