fix: preserve changes across config editor tabs when saving#43
Merged
Conversation
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
Fixes a bug where editing links on the Links tab, then switching to the General tab and saving, would discard the link changes. Each tab maintained its own isolated copy of the config, so saving from one tab would overwrite changes made on the other.
Changes
src/screens/ConfigEditorScreen/ConfigEditorScreen.tsx— Lifted config editing state into a shareddraftConfigheld by the parent. Both tabs now receive this draft and push their changes back via anonConfigChangecallback. The parent'shandleSavewrapsonSave+onCloseso closing happens in one place.src/screens/ConfigEditorScreen/components/GeneralTab.tsx— AddedonConfigChangeprop and auseEffectthat pushes general-tab form state changes to the shared draft so they persist across tab switches.src/screens/ConfigEditorScreen/components/LinksTab.tsx— AddedonConfigChangeprop and auseEffectthat pushes module changes to the shared draft. Removed redundantonClose()call fromhandleSave(now handled by parent).src/screens/ConfigEditorScreen/ConfigEditorScreen.test.tsx— Added two integration tests verifying cross-tab persistence: saving from General preserves link changes, and saving from Links preserves general changes.src/screens/ConfigEditorScreen/components/GeneralTab.test.tsx— AddedonConfigChangemock to default props.src/screens/ConfigEditorScreen/components/LinksTab.test.tsx— AddedonConfigChangemock to default props; updated save test to reflect thatonCloseis no longer called directly by LinksTab.Issue Reference
Closes #38
Testing
All 84 tests pass, lint is clean, and the production build succeeds.
Verification
This PR was automatically generated by an AI agent (Claude Code). Please review carefully before merging.