Skip to content

A local-first personal finance app

[AI] Preserve categories during QIF transaction import (#9041)

Soba7e683249a949
diff --git a/packages/desktop-client/e2e/accounts.test.ts b/packages/desktop-client/e2e/accounts.test.ts
index 6238ac67ff..e4285d35cd 100644
--- a/packages/desktop-client/e2e/accounts.test.ts
+++ b/packages/desktop-client/e2e/accounts.test.ts
@@ -324,6 +324,31 @@ test.describe('Accounts', () => {
await importCsv(true);
});
+ test('preserves QIF categories in preview and imported transactions', async () => {
+ const fileChooserPromise = page.waitForEvent('filechooser');
+ await accountPage.page.getByRole('button', { name: 'Import' }).click();
+
+ const fileChooser = await fileChooserPromise;
+ await fileChooser.setFiles(join(__dirname, 'data/qif-categories.qif'));
+
+ const dialog = page.getByRole('dialog');
+ await expect(dialog.getByText('Food', { exact: true })).toBeVisible();
+ await expect(dialog.getByText('Income', { exact: true })).toBeVisible();
+
+ await dialog
+ .getByRole('button', { name: 'Import 2 transactions' })
+ .click();
+
+ const expense = accountPage.transactionTableRow.filter({
+ hasText: 'QIF Cafe',
+ });
+ const income = accountPage.transactionTableRow.filter({
+ hasText: 'QIF Salary',
+ });
+ await expect(expense.getByTestId('category')).toHaveText('Food');
+ await expect(income.getByTestId('category')).toHaveText('Income');
+ });
+
test('import csv file twice', async () => {
await importCsv(false);
diff --git a/packages/desktop-client/e2e/data/qif-categories.qif b/packages/desktop-client/e2e/data/qif-categories.qif
new file mode 100644
index 0000000000..85c7bd2551
--- /dev/null
+++ b/packages/desktop-client/e2e/data/qif-categories.qif
@@ -0,0 +1,11 @@
+!Type:Bank
+D8/18/2026
+PQIF Cafe
+T-9.40
+LUsual Expenses:Food
+^
+D8/19/2026
+PQIF Salary
+T50.00
+LIncome:Income
+^
diff --git a/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.tsx b/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.tsx
index 5fd2b59d73..1c5eb29f2e 100644
--- a/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.tsx
+++ b/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.tsx
@@ -350,7 +350,6 @@ export function ImportTransactionsModal({
}
const category_id = parseCategoryFields(trans, categories);
- trans.category = category_id;
const {
inflow: _inflow,
@@ -365,6 +364,7 @@ export function ImportTransactionsModal({
} = trans;
previewTransactions.push({
...finalTransaction,
+ category: category_id,
date,
amount: amountToInteger(amount),
cleared: clearOnImport,
@@ -681,7 +681,6 @@ export function ImportTransactionsModal({
}
const category_id = parseCategoryFields(trans, categories);
- trans.category = category_id;
const {
inflow: _inflow,
@@ -708,6 +707,7 @@ export function ImportTransactionsModal({
finalTransactions.push({
...finalTransaction,
+ category: category_id,
date,
amount: amountToInteger(amount),
cleared: clearOnImport,
diff --git a/upcoming-release-notes/preserve-qif-import-categories.md b/upcoming-release-notes/preserve-qif-import-categories.md
new file mode 100644
index 0000000000..ca490e1605
--- /dev/null
+++ b/upcoming-release-notes/preserve-qif-import-categories.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [Soba101]
+---
+
+Preserve matching categories when importing transactions from QIF files