Skip to content

A local-first personal finance app

Fix warning modal not showing a second time. (#2956)

Robert Dyerf18bce60946a
diff --git a/packages/desktop-client/src/components/Modals.tsx b/packages/desktop-client/src/components/Modals.tsx
index 81f48f391e..ac5b894b2c 100644
--- a/packages/desktop-client/src/components/Modals.tsx
+++ b/packages/desktop-client/src/components/Modals.tsx
@@ -173,6 +173,7 @@ export function Modals() {
<ConfirmTransactionEdit
key={name}
modalProps={modalProps}
+ onCancel={options.onCancel}
onConfirm={options.onConfirm}
confirmReason={options.confirmReason}
/>
diff --git a/packages/desktop-client/src/components/modals/ConfirmTransactionEdit.tsx b/packages/desktop-client/src/components/modals/ConfirmTransactionEdit.tsx
index 6fb4c80077..7ad0ff097f 100644
--- a/packages/desktop-client/src/components/modals/ConfirmTransactionEdit.tsx
+++ b/packages/desktop-client/src/components/modals/ConfirmTransactionEdit.tsx
@@ -9,12 +9,14 @@ import { type CommonModalProps } from '../Modals';
type ConfirmTransactionEditProps = {
modalProps: Partial<CommonModalProps>;
+ onCancel?: () => void;
onConfirm: () => void;
confirmReason: string;
};
export function ConfirmTransactionEdit({
modalProps,
+ onCancel,
onConfirm,
confirmReason,
}: ConfirmTransactionEditProps) {
@@ -71,7 +73,13 @@ export function ConfirmTransactionEdit({
justifyContent: 'flex-end',
}}
>
- <Button style={{ marginRight: 10 }} onClick={modalProps.onClose}>
+ <Button
+ style={{ marginRight: 10 }}
+ onClick={() => {
+ modalProps.onClose();
+ onCancel();
+ }}
+ >
Cancel
</Button>
<Button
diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx
index b860929876..d3225f3719 100644
--- a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx
+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx
@@ -730,7 +730,7 @@ const Transaction = memo(function Transaction({
function onUpdate(name, value) {
// Had some issues with this is called twice which is a problem now that we are showing a warning
- // modal is the transaction is locked. I added a boolean to guard against showing the modal twice.
+ // modal if the transaction is locked. I added a boolean to guard against showing the modal twice.
// I'm still not completely happy with how the cells update pre/post modal. Sometimes you have to
// click off of the cell manually after confirming your change post modal for example. The last
// row seems to have more issues than others but the combination of tab, return, and clicking out
@@ -749,6 +749,9 @@ const Transaction = memo(function Transaction({
setShowReconciliationWarning(true);
dispatch(
pushModal('confirm-transaction-edit', {
+ onCancel: () => {
+ setShowReconciliationWarning(false);
+ },
onConfirm: () => {
setShowReconciliationWarning(false);
onUpdateAfterConfirm(name, value);
diff --git a/packages/loot-core/src/client/state-types/modals.d.ts b/packages/loot-core/src/client/state-types/modals.d.ts
index f45233af13..3c091e1cc9 100644
--- a/packages/loot-core/src/client/state-types/modals.d.ts
+++ b/packages/loot-core/src/client/state-types/modals.d.ts
@@ -252,6 +252,7 @@ type FinanceModals = {
'budget-list';
'confirm-transaction-edit': {
onConfirm: () => void;
+ onCancel?: () => void;
confirmReason: string;
};
'confirm-transaction-delete': {
diff --git a/upcoming-release-notes/2956.md b/upcoming-release-notes/2956.md
new file mode 100644
index 0000000000..5ea7a72abd
--- /dev/null
+++ b/upcoming-release-notes/2956.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [psybers]
+---
+
+Fix: Warning modal was not showing a second time.