From d649eec4db2f01284acb6f3a5eb292311fc7814a Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Mon, 9 Dec 2024 21:59:55 +0000 Subject: [PATCH 1/2] :bug: fix misaligned gocardless credential popover (#3942) --- .../components/modals/CreateAccountModal.tsx | 50 ++++++------------- .../loot-core/src/types/server-handlers.d.ts | 2 +- upcoming-release-notes/3942.md | 6 +++ 3 files changed, 23 insertions(+), 35 deletions(-) create mode 100644 upcoming-release-notes/3942.md diff --git a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx b/packages/desktop-client/src/components/modals/CreateAccountModal.tsx index 8f62089c913..6ba131bf6dd 100644 --- a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx +++ b/packages/desktop-client/src/components/modals/CreateAccountModal.tsx @@ -1,5 +1,5 @@ -// @ts-strict-ignore -import React, { useEffect, useRef, useState } from 'react'; +import React, { useEffect, useState } from 'react'; +import { DialogTrigger } from 'react-aria-components'; import { useTranslation } from 'react-i18next'; import { useDispatch } from 'react-redux'; @@ -30,13 +30,12 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) { const { t } = useTranslation(); const syncServerStatus = useSyncServerStatus(); const dispatch = useDispatch(); - const [isGoCardlessSetupComplete, setIsGoCardlessSetupComplete] = - useState(null); - const [isSimpleFinSetupComplete, setIsSimpleFinSetupComplete] = - useState(null); - const [menuGoCardlessOpen, setGoCardlessMenuOpen] = useState(false); - const triggerRef = useRef(null); - const [menuSimplefinOpen, setSimplefinMenuOpen] = useState(false); + const [isGoCardlessSetupComplete, setIsGoCardlessSetupComplete] = useState< + boolean | null + >(null); + const [isSimpleFinSetupComplete, setIsSimpleFinSetupComplete] = useState< + boolean | null + >(null); const onConnectGoCardless = () => { if (!isGoCardlessSetupComplete) { @@ -139,7 +138,6 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) { value: null, }).then(() => { setIsGoCardlessSetupComplete(false); - setGoCardlessMenuOpen(false); }); }); }; @@ -154,7 +152,6 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) { value: null, }).then(() => { setIsSimpleFinSetupComplete(false); - setSimplefinMenuOpen(false); }); }); }; @@ -248,12 +245,10 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) { : t('Set up GoCardless for bank sync')} {isGoCardlessSetupComplete && ( - <> + - setGoCardlessMenuOpen(false)} - > + { if (item === 'reconfigure') { @@ -281,7 +272,7 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) { ]} /> - + )} @@ -317,24 +308,15 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) { : t('Set up SimpleFIN for bank sync')} {isSimpleFinSetupComplete && ( - <> - - setSimplefinMenuOpen(false)} - > + { if (item === 'reconfigure') { @@ -349,7 +331,7 @@ export function CreateAccountModal({ upgradingAccountId }: CreateAccountProps) { ]} /> - + )} diff --git a/packages/loot-core/src/types/server-handlers.d.ts b/packages/loot-core/src/types/server-handlers.d.ts index 4afbc72a3e8..657244b3cc5 100644 --- a/packages/loot-core/src/types/server-handlers.d.ts +++ b/packages/loot-core/src/types/server-handlers.d.ts @@ -178,7 +178,7 @@ export interface ServerHandlers { 'account-move': (arg: { id; targetId }) => Promise; - 'secret-set': (arg: { name: string; value: string }) => Promise; + 'secret-set': (arg: { name: string; value: string | null }) => Promise; 'secret-check': (arg: string) => Promise; 'gocardless-poll-web-token': (arg: { diff --git a/upcoming-release-notes/3942.md b/upcoming-release-notes/3942.md new file mode 100644 index 00000000000..c66d2b9326b --- /dev/null +++ b/upcoming-release-notes/3942.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [MatissJanis] +--- + +Fix misaligned gocardless credential popover. From a2892270d23917c2ba74e45206d7b1d775f8fbd1 Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Mon, 9 Dec 2024 22:00:36 +0000 Subject: [PATCH 2/2] :bug: fix condition "notes contains (nothing)" throwing error (#3943) --- packages/loot-core/src/server/accounts/transaction-rules.ts | 6 +++++- upcoming-release-notes/3943.md | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 upcoming-release-notes/3943.md diff --git a/packages/loot-core/src/server/accounts/transaction-rules.ts b/packages/loot-core/src/server/accounts/transaction-rules.ts index 2c2569a5fc8..cfa534ef7ce 100644 --- a/packages/loot-core/src/server/accounts/transaction-rules.ts +++ b/packages/loot-core/src/server/accounts/transaction-rules.ts @@ -291,7 +291,11 @@ export async function runRules(trans) { return await finalizeTransactionForRules(finalTrans); } -function conditionSpecialCases(cond: Condition): Condition { +function conditionSpecialCases(cond: Condition | null): Condition | null { + if (!cond) { + return cond; + } + //special cases that require multiple conditions if (cond.op === 'is' && cond.field === 'category' && cond.value === null) { return new Condition( diff --git a/upcoming-release-notes/3943.md b/upcoming-release-notes/3943.md new file mode 100644 index 00000000000..988e0ac840c --- /dev/null +++ b/upcoming-release-notes/3943.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [MatissJanis] +--- + +Fix rule creation throwing error for "notes contains (nothing)" condition.