[PR #6240] [MERGED] Fix merging split transactions #40834

Closed
opened 2026-04-23 13:38:32 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/6240
Author: @Respheal
Created: 11/24/2025
Status: Merged
Merged: 12/17/2025
Merged by: @youngcw

Base: masterHead: PR-5856-CI-Review


📝 Commits (10+)

  • d29be71 fix(transactions): preserve split categories when merging with imported uncategorized tx; avoid orphaned subtransactions
  • 782e487 docs: add release note for PR #5856
  • 5756f75 fix: resolve lint and typecheck errors
  • c991adf refactor: optimize subtransaction queries and test db access
  • 8879b26 [autofix.ci] apply automated fixes
  • cd46f72 Merge branch 'master' into fix/merge-split-preserve-categories
  • 89c84d9 refactor: apply code review feedback with stable branch logic
  • 90a9641 chore(release-notes): set category to Enhancements and shorten text; fix(merge): use shared deleteTransaction with grouped fetch + batchUpdateTransactions
  • 7cfcb77 Merge branch 'master' into PR-5856-CI-Review
  • 35478ce resolving lint warnings and recommendation on the test query

📊 Changes

3 files changed (+168 additions, -5 deletions)

View changed files

📝 packages/loot-core/src/server/transactions/merge.test.ts (+84 -0)
📝 packages/loot-core/src/server/transactions/merge.ts (+78 -5)
upcoming-release-notes/6240.md (+6 -0)

📄 Description

Fixes https://github.com/actualbudget/actual/issues/5781

This resolves the lint and testing issues identified in https://github.com/actualbudget/actual/pull/5856, which was closed for inactivity. The following description is taken from that PR:

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:

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/6240 **Author:** [@Respheal](https://github.com/Respheal) **Created:** 11/24/2025 **Status:** ✅ Merged **Merged:** 12/17/2025 **Merged by:** [@youngcw](https://github.com/youngcw) **Base:** `master` ← **Head:** `PR-5856-CI-Review` --- ### 📝 Commits (10+) - [`d29be71`](https://github.com/actualbudget/actual/commit/d29be719dd1c2fed0db2d09b06e459fed55fe159) fix(transactions): preserve split categories when merging with imported uncategorized tx; avoid orphaned subtransactions - [`782e487`](https://github.com/actualbudget/actual/commit/782e4874e44e03c338f4af5e112c7d5207db03ac) docs: add release note for PR #5856 - [`5756f75`](https://github.com/actualbudget/actual/commit/5756f755cae854e2000abbc1a7c8fd21c6a7cd56) fix: resolve lint and typecheck errors - [`c991adf`](https://github.com/actualbudget/actual/commit/c991adf5d140f6ef5b308b44fd5ae3710a589e37) refactor: optimize subtransaction queries and test db access - [`8879b26`](https://github.com/actualbudget/actual/commit/8879b26b02480f304bc09c83401fda24eea3bff1) [autofix.ci] apply automated fixes - [`cd46f72`](https://github.com/actualbudget/actual/commit/cd46f72650ea36acc9721e71c5a3d40a77406c53) Merge branch 'master' into fix/merge-split-preserve-categories - [`89c84d9`](https://github.com/actualbudget/actual/commit/89c84d964f429cfb9bf3827c0f2605740e81edf7) refactor: apply code review feedback with stable branch logic - [`90a9641`](https://github.com/actualbudget/actual/commit/90a96418498e71dfa903cc8b1e870ba5b5571de0) chore(release-notes): set category to Enhancements and shorten text; fix(merge): use shared deleteTransaction with grouped fetch + batchUpdateTransactions - [`7cfcb77`](https://github.com/actualbudget/actual/commit/7cfcb77c75f1f5df02b96f0f773545b011b40ed6) Merge branch 'master' into PR-5856-CI-Review - [`35478ce`](https://github.com/actualbudget/actual/commit/35478ce43eaec0a3b8845213aa205a3299a95004) resolving lint warnings and recommendation on the test query ### 📊 Changes **3 files changed** (+168 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/server/transactions/merge.test.ts` (+84 -0) 📝 `packages/loot-core/src/server/transactions/merge.ts` (+78 -5) ➕ `upcoming-release-notes/6240.md` (+6 -0) </details> ### 📄 Description Fixes https://github.com/actualbudget/actual/issues/5781 This resolves the lint and testing issues identified in https://github.com/actualbudget/actual/pull/5856, which was closed for inactivity. The following description is taken from that PR: ## 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: - Creates a manual parent transaction with 2 subtransactions (different categories) - Creates an imported transaction without splits - Merges them - Verifies subtransactions are transferred with correct parent_id - Verifies no orphaned subtransactions remain --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 13:38:32 -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#40834