Fix account transaction form resetting amount to 0 #1133

Merged
zachgoll merged 1 commits from zachgoll/fix-1132 into main 2024-08-27 07:10:17 +08:00
zachgoll commented 2024-08-27 03:51:25 +08:00 (Migrated from github.com)

Fixes #1132

Fixes #1132
zachgoll (Migrated from github.com) reviewed 2024-08-27 03:53:00 +08:00
@@ -15,3 +15,2 @@
@entry.update!(entry_params.merge(amount: amount))
@entry.sync_account_later
@entry.update!(entry_params)
zachgoll (Migrated from github.com) commented 2024-08-27 03:53:00 +08:00

Removed the sync_later because this triggers a refresh of the entire page (via the Sync broadcasts) which gets annoying for updating transaction details. This will cause out-of-sync data if the user changes the amount or date, but will be updated on the next sync.

Eventually we'll want to get more granular with when we trigger the re-sync, but for now this feels like a decent tradeoff.

Removed the `sync_later` because this triggers a refresh of the entire page (via the Sync broadcasts) which gets annoying for updating transaction details. This will cause out-of-sync data if the user changes the amount or date, but will be updated on the next sync. Eventually we'll want to get more granular with _when_ we trigger the re-sync, but for now this feels like a decent tradeoff.
zachgoll (Migrated from github.com) reviewed 2024-08-27 03:53:39 +08:00
@@ -14,3 +14,2 @@
def update
@entry.update!(entry_params.merge(amount: amount))
@entry.sync_account_later
@entry.update!(entry_params)
zachgoll (Migrated from github.com) commented 2024-08-27 03:53:38 +08:00

Merging in amount caused the scenario when we didn't include the param, it was calling nil.to_d, which resulted in 0

Merging in `amount` caused the scenario when we didn't include the param, it was calling `nil.to_d`, which resulted in 0
Sign in to join this conversation.