[PR #5856] fix(transactions): preserve split categories on merge #20530

Closed
opened 2026-04-14 21:39:45 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/5856

State: closed
Merged: No


When merging a split-categorized manual transaction with an uncategorized imported one, keep the split lines (including categoryId) and avoid leaving orphaned subtransactions.

Changes

  • Modified mergeTransactions to load subtransactions for both transactions being merged
  • When the kept transaction doesn't have splits but the dropped one does, transfer all subtransactions by updating their parent_id
  • Mark the kept transaction as is_parent and clear its category (parent transactions with splits shouldn't have a direct category)
  • Added comprehensive test covering this scenario

Test Plan

Added test preserves split categories when merging split transaction with uncategorized imported transaction which:

  1. Creates a manual parent transaction with 2 subtransactions (different categories)
  2. Creates an imported transaction without splits
  3. Merges them
  4. Verifies subtransactions are transferred with correct parent_id
  5. Verifies no orphaned subtransactions remain

All tests pass.

Fixes #5781

**Original Pull Request:** https://github.com/actualbudget/actual/pull/5856 **State:** closed **Merged:** No --- When merging a split-categorized manual transaction with an uncategorized imported one, keep the split lines (including categoryId) and avoid leaving orphaned subtransactions. ## Changes - Modified `mergeTransactions` to load subtransactions for both transactions being merged - When the kept transaction doesn't have splits but the dropped one does, transfer all subtransactions by updating their `parent_id` - Mark the kept transaction as `is_parent` and clear its category (parent transactions with splits shouldn't have a direct category) - Added comprehensive test covering this scenario ## Test Plan Added test `preserves split categories when merging split transaction with uncategorized imported transaction` which: 1. Creates a manual parent transaction with 2 subtransactions (different categories) 2. Creates an imported transaction without splits 3. Merges them 4. Verifies subtransactions are transferred with correct `parent_id` 5. Verifies no orphaned subtransactions remain All tests pass. Fixes #5781
GiteaMirror added the pull-request label 2026-04-14 21:39:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#20530