Skip to content

A local-first personal finance app

[Mobile] Do not show transfer transactions on uncategorized transactions view/page (#5589)

Joel Jeremy Marquez284fc131615a
diff --git a/packages/desktop-client/src/components/mobile/budget/UncategorizedTransactions.tsx b/packages/desktop-client/src/components/mobile/budget/UncategorizedTransactions.tsx
index a477385aad..4b26b7bd4b 100644
--- a/packages/desktop-client/src/components/mobile/budget/UncategorizedTransactions.tsx
+++ b/packages/desktop-client/src/components/mobile/budget/UncategorizedTransactions.tsx
@@ -1,7 +1,6 @@
import React, { useCallback, useEffect, useState } from 'react';
import { listen } from 'loot-core/platform/client/fetch';
-import { q } from 'loot-core/shared/query';
import { isPreviewId } from 'loot-core/shared/transactions';
import { type TransactionEntity } from 'loot-core/types/models';
@@ -11,19 +10,15 @@ import { useDateFormat } from '@desktop-client/hooks/useDateFormat';
import { useNavigate } from '@desktop-client/hooks/useNavigate';
import { useTransactions } from '@desktop-client/hooks/useTransactions';
import { useTransactionsSearch } from '@desktop-client/hooks/useTransactionsSearch';
+import { uncategorizedTransactions } from '@desktop-client/queries';
import { useDispatch } from '@desktop-client/redux';
import * as bindings from '@desktop-client/spreadsheet/bindings';
export function UncategorizedTransactions() {
const dispatch = useDispatch();
const navigate = useNavigate();
-
const baseTransactionsQuery = useCallback(
- () =>
- q('transactions')
- .options({ splits: 'inline' })
- .filter({ $and: [{ category: null }, { 'account.offbudget': false }] })
- .select('*'),
+ () => uncategorizedTransactions().options({ splits: 'inline' }).select('*'),
[],
);
diff --git a/packages/desktop-client/src/queries/index.ts b/packages/desktop-client/src/queries/index.ts
index 2a13a9d630..e97ae1e5ca 100644
--- a/packages/desktop-client/src/queries/index.ts
+++ b/packages/desktop-client/src/queries/index.ts
@@ -117,3 +117,16 @@ export function transactionsSearch(
},
});
}
+
+export function uncategorizedTransactions() {
+ return q('transactions').filter({
+ 'account.offbudget': false,
+ category: null,
+ $or: [
+ {
+ 'payee.transfer_acct.offbudget': true,
+ 'payee.transfer_acct': null,
+ },
+ ],
+ });
+}
diff --git a/packages/desktop-client/src/spreadsheet/bindings.ts b/packages/desktop-client/src/spreadsheet/bindings.ts
index aa0161c6de..c4f2683175 100644
--- a/packages/desktop-client/src/spreadsheet/bindings.ts
+++ b/packages/desktop-client/src/spreadsheet/bindings.ts
@@ -8,6 +8,8 @@ import {
type SheetNames,
} from '.';
+import { uncategorizedTransactions } from '@desktop-client/queries';
+
type BudgetType<SheetName extends SheetNames> = Record<
string,
SheetFields<SheetName> | ((id: string) => SheetFields<SheetName>)
@@ -133,28 +135,18 @@ export function categoryBalanceUncleared(
.calculate({ $sum: '$amount' }),
} satisfies Binding<'category', 'balanceUncleared'>;
}
-const uncategorizedQuery = q('transactions').filter({
- 'account.offbudget': false,
- category: null,
- $or: [
- {
- 'payee.transfer_acct.offbudget': true,
- 'payee.transfer_acct': null,
- },
- ],
-});
export function uncategorizedBalance<SheetName extends SheetNames>() {
return {
name: 'uncategorized-balance',
- query: uncategorizedQuery.calculate({ $sum: '$amount' }),
+ query: uncategorizedTransactions().calculate({ $sum: '$amount' }),
} satisfies Binding<SheetName, 'uncategorized-balance'>;
}
export function uncategorizedCount<SheetName extends SheetNames>() {
return {
name: 'uncategorized-amount',
- query: uncategorizedQuery.calculate({ $count: '$id' }),
+ query: uncategorizedTransactions().calculate({ $count: '$id' }),
} satisfies Binding<SheetName, 'uncategorized-amount'>;
}
diff --git a/upcoming-release-notes/5589.md b/upcoming-release-notes/5589.md
new file mode 100644
index 0000000000..905a3d6484
--- /dev/null
+++ b/upcoming-release-notes/5589.md
@@ -0,0 +1,7 @@
+---
+category: Bugfix
+authors: [joel-jeremy]
+---
+
+Hide transfer transactions from the uncategorized transactions view in the mobile app.
+