-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix CSV import not matching category is (nothing) rules #2790
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller
Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks to be working well.
I also double-confirmed that this doesn't result in manual transactions loosing their category when being reconciled with an import that matches.
Fixes #2052
@Maxiimeeb was correct in the issue that the root cause of this is the fact that the csv import passes new transactions down the stack with
{ category: undefined }
if the category is not set in the CSV.The
eval
function in theCondition
class has a guard that fails the rule if the value it's checking is strictly equal toundefined
.actual/packages/loot-core/src/server/accounts/rules.ts
Lines 264 to 266 in b803731
This change takes one of the two possible approaches, which is to pass
null
as the category if unset instead ofundefined
. parseCategoryFields already does this so it makes sense just to use its return value.actual/packages/desktop-client/src/components/modals/ImportTransactions.jsx
Lines 313 to 324 in b803731
The other way this could be fixed is to amend the guard condition to pick up any nullish values and return accordingly straight away but I'm not sure if this approach would be in line with existing conventions throughout the project for usage of
null
andundefined
.