diff --git a/packages/desktop-client/src/components/Modals.tsx b/packages/desktop-client/src/components/Modals.tsx index 81f48f391e5d39c72f4f737824ad9cc69d9fc7ad..ac5b894b2c569f36fccc6a675ce469e9dae28472 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 6fb4c8007753faac4ec00dfafcd11d9eedc570c1..7ad0ff097fbd562239f83d36a8c4a2d0ab5cbf12 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 b860929876c1625ae1cea82b874fbde57f2603b0..d3225f37192ba9bb72c0dd6583b59affce9bd113 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 f45233af13203199e0c3686de7d4ef31d335a4a7..3c091e1cc9a6cd514bb542ee4c5a7075c49e2020 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 0000000000000000000000000000000000000000..5ea7a72abdd168f9778eea5bcba72af58ae378a1 --- /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.