feat: persist per-preset stage collapse state#204
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
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>>toSettingswith 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 toselected_preset = Nonewhen the deleted preset was selected, butPresetHandler::delete_presetwill 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. Updatesettings.selected_presetto the handler's newly selected preset after deletion (or change the flow so settings is always kept in sync withPresetHandler).
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.
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 "".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
settings.jsonas aHashMap<preset_name, Vec<bool>>Test plan
make lintpassesmake testpasses (62 tests)🤖 Generated with Claude Code