Repository navigation
[AI] Fix append/prepend notes rules on new transactions - #8300
Conversation
Append/prepend notes rules were ignored when adding a new transaction that already had a note, because rule changes are only applied to fields the user left empty (so manual input isn't overwritten). Add a shared `shouldApplyRuleChange` helper that still protects user-entered values but lets the notes field through when the rule result preserves the existing note as a prefix or suffix (append/prepend). The check is idempotent: rules re-run on every keystroke during entry, so it refuses to re-add text that a previous run already applied, preventing the appended text from duplicating. Used by both the desktop register and the mobile transaction editor. Co-Authored-By: Claude Opus 4.8 <[email protected]>
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughA new exported helper ChangesRule-field application fix for append/prepend notes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
matt-fidd
left a comment
There was a problem hiding this comment.
Thanks for doing this one, hopefully that'll stem some of the spam
…#8300) Append/prepend notes rules were ignored when adding a new transaction that already had a note, because rule changes are only applied to fields the user left empty (so manual input isn't overwritten). Add a shared `shouldApplyRuleChange` helper that still protects user-entered values but lets the notes field through when the rule result preserves the existing note as a prefix or suffix (append/prepend). The check is idempotent: rules re-run on every keystroke during entry, so it refuses to re-add text that a previous run already applied, preventing the appended text from duplicating. Used by both the desktop register and the mobile transaction editor. Co-authored-by: Claude Opus 4.8 <[email protected]>
Description
For some reason bots (presumably) really love solving this issue. But all of the solutions were incomplete.
When you add a new transaction that already has a note and a rule is set up to add text to that note, the app re-runs rules repeatedly as you fill in the transaction.. Once for each field you touch and again when you save. The two existing fixes make the rule's text get added, but they don't stop it from being added again on each of those repeats, so a note that should read "Coffee and cake - paid" ends up as "Coffee and cake - paid - paid - paid," with the rule's text duplicated several times.
Related issue(s)
#8003
#8296
Fixes #7303
Testing
unit tests added and manual verification done
Checklist
Bundle Stats
View detailed bundle stats
desktop-client
Total
Changeset
src/components/transactions/table/utils.tspackage.jsonsrc/components/mobile/transactions/TransactionEdit.tsxsrc/components/transactions/TransactionList.tsxView detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
Smaller
No assets were smaller
Unchanged
loot-core
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged
api
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged
cli
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged
crdt
Total
View detailed bundle breakdown
Added
No assets were added
Removed
No assets were removed
Bigger
No assets were bigger
Smaller
No assets were smaller
Unchanged