Skip to content

feat: persist per-preset stage collapse state#204

Merged
OpenSauce merged 2 commits intomainfrom
feat/persist-collapse-state
Mar 1, 2026
Merged

feat: persist per-preset stage collapse state#204
OpenSauce merged 2 commits intomainfrom
feat/persist-collapse-state

Conversation

@OpenSauce
Copy link
Copy Markdown
Owner

@OpenSauce OpenSauce commented Mar 1, 2026

Summary

  • Persist each preset's stage collapsed/expanded layout in settings.json as a HashMap<preset_name, Vec<bool>>
  • Collapse state is restored when switching presets or restarting the app
  • State is saved on toggle, add, remove, and reorder operations
  • Stale entries are cleaned up on preset deletion
  • Skips persistence when no preset is selected to avoid orphaned entries
  • Backwards compatible — existing settings files without the field deserialize with an empty map

Test plan

  • make lint passes
  • make test passes (62 tests)
  • Collapse some stages, restart app — verify they remain collapsed
  • Switch between presets — verify each preset remembers its own collapse state
  • Add/remove/reorder stages — verify collapse state updates correctly
  • Delete a preset — verify its collapse entry is removed from settings.json

🤖 Generated with Claude Code

Store each preset's collapsed/expanded stage layout in settings.json
as a HashMap<preset_name, Vec<bool>>. Collapse state is restored when
switching presets or restarting the app. Stale entries are cleaned up
on preset deletion, and no-preset state skips persistence.
Copilot AI review requested due to automatic review settings March 1, 2026 00:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds persistence of the stage collapsed/expanded UI state on a per-preset basis by storing it in settings.json, so the layout is restored when switching presets or restarting the app.

Changes:

  • Add collapsed_stages: HashMap<String, Vec<bool>> to Settings with a default empty map.
  • Restore collapsed state per preset during app boot and when loading stages for a preset.
  • Persist collapsed state on toggle/add/remove/reorder and clean up state on preset deletion.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/settings/mod.rs Extends Settings to serialize/deserialize per-preset collapsed stage state.
src/gui/app.rs Restores/persists collapse state across preset switches and app restarts; removes stale state on preset deletion.
Comments suppressed due to low confidence (1)

src/gui/app.rs:431

  • On PresetMessage::Delete, the settings are updated to selected_preset = None when the deleted preset was selected, but PresetHandler::delete_preset will auto-select the first remaining preset. This leaves settings and UI out of sync; it also means collapse state restoration/persistence will use the empty key and effectively stop persisting until the user manually re-selects a preset. Update settings.selected_preset to the handler's newly selected preset after deletion (or change the flow so settings is always kept in sync with PresetHandler).
                    PresetMessage::Delete(deleted_name) => {
                        self.settings.collapsed_stages.remove(&deleted_name);
                        if self.settings.selected_preset == Some(deleted_name) {
                            self.settings.selected_preset = None;
                        }
                        self.save_settings();

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/gui/app.rs Outdated
Comment thread src/gui/app.rs Outdated
Use preset.name instead of settings.selected_preset for collapse key
during boot, since the preset handler may fall back to a different
preset if the saved one is missing. Also handle None selected_preset
gracefully in SetStages by resizing instead of looking up under "".
@OpenSauce OpenSauce enabled auto-merge (squash) March 1, 2026 00:51
@OpenSauce OpenSauce merged commit f4e538e into main Mar 1, 2026
7 checks passed
@OpenSauce OpenSauce deleted the feat/persist-collapse-state branch March 1, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants