A local-first personal finance app
ensure transaction values are saved before adding (#7268)
Matt Fiddaman9232e0d91030
diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.tsx b/packages/desktop-client/src/components/transactions/TransactionsTable.tsxindex e16f6b4ac7..46373f4283 100644--- a/packages/desktop-client/src/components/transactions/TransactionsTable.tsx+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.tsx@@ -2883,11 +2883,13 @@ export const TransactionTable = forwardRef(useEffect(() => {if (savePending.current && afterSaveFunc.current) {- afterSaveFunc.current();+ const func = afterSaveFunc.current;afterSaveFunc.current = null;+ savePending.current = false;+ func();+ } else {+ savePending.current = false;}-- savePending.current = false;}, [newTransactions, props, props.transactions]);function getFieldsNewTransaction(item?: TransactionEntity) {@@ -3024,11 +3026,13 @@ export const TransactionTable = forwardRef(}const onAddTemporary = useCallback(() => {- shouldAdd.current = true;- // A little hacky - this forces a rerender which will cause the- // effect we want to run. We have to wait for all updates to be- // committed (the input could still be saving a value).- forceRerender({});+ afterSave(() => {+ shouldAdd.current = true;+ // A little hacky - this forces a rerender which will cause the+ // effect we want to run. We have to wait for all updates to be+ // committed (the input could still be saving a value).+ forceRerender({});+ });}, []);const onAddAndCloseTemporary = useCallback(() => {diff --git a/upcoming-release-notes/7268.md b/upcoming-release-notes/7268.mdnew file mode 100644index 0000000000..dfec1285aa--- /dev/null+++ b/upcoming-release-notes/7268.md@@ -0,0 +1,6 @@+---+category: Bugfixes+authors: [matt-fidd]+---++Fix transaction amounts sometimes not being saved when adding through the desktop view on a touch device