Skip to content

fix(ConfigUI): reload config editor when switching configurations#6

Merged
diranged merged 1 commit into
mainfrom
fix/config-editor-stale-state
Apr 8, 2026
Merged

fix(ConfigUI): reload config editor when switching configurations#6
diranged merged 1 commit into
mainfrom
fix/config-editor-stale-state

Conversation

@diranged

@diranged diranged commented Apr 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bug: Whichever configuration was opened first, its values would stick when clicking other configs in the sidebar
  • Cause: ConfigEditorView loaded config via .onAppear, which only fires once — SwiftUI reuses the view when the sidebar selection changes
  • Fix: Add .id(manager.configPath) to force SwiftUI to recreate the editor on selection change, triggering a fresh loadConfig()

Test plan

  • Open Graftery with multiple configs
  • Click between configs in the sidebar — verify each config's values load correctly
  • Edit a field, switch configs, switch back — verify changes persisted and didn't leak

🤖 Generated with Claude Code

ConfigEditorView loaded config data only in .onAppear, which doesn't
re-fire when SwiftUI reuses the view for a different sidebar selection.
This caused the first config's values to stick across all selections.

Adding .id(manager.configPath) forces SwiftUI to recreate the editor
when the selected config changes, triggering a fresh loadConfig().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@diranged diranged merged commit 571ced9 into main Apr 8, 2026
4 checks passed
@diranged diranged deleted the fix/config-editor-stale-state branch April 8, 2026 23:04
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.

1 participant