Open IuliiaHerets opened 1 month ago
Triggered auto assignment to @johncschuster (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
We think that this bug might be related to #wave-collect - Release 1
@johncschuster FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
App crash when employee submit request and then the admin open the expense report.
The error comes from hasEnabledTags
function.
https://github.com/Expensify/App/blob/cf897a002e8949eb429026a020f23f92c2de6bee/src/components/ReportActionItem/MoneyRequestView.tsx#L220
Inside the function, we map over the tag array, and the map callback destructuring the tag by taking the tags
property, but in our case, the tags
is undefined, so Object.values
throws an error.
https://github.com/Expensify/App/blob/cf897a002e8949eb429026a020f23f92c2de6bee/src/libs/OptionsListUtils.ts#L1366-L1367
The tag array (policyTagList) normally looks like this:
[{name: "Tag", orderWeight: 0, required: false, tags: {...}}]
The array is constructed from the tag object by taking the object values. https://github.com/Expensify/App/blob/cf897a002e8949eb429026a020f23f92c2de6bee/src/libs/PolicyUtils.ts#L274-L279
But in our case, the tag list looks like this:
Each object in the array structure is totally different from the normal structure above and doesn't have a tags
property, so the app crashes.
The reason of that is because, when the admin receives the pusher data of the new money request, the transaction thread report contains a very minimal information which doesn't include policyID
, so when we are trying to get the policy tag object, the policyID
defaults to an empty string and fetch the whole tag collections.
https://github.com/Expensify/App/blob/cf897a002e8949eb429026a020f23f92c2de6bee/src/components/ReportActionItem/MoneyRequestView.tsx#L692-L694
policy_A: {
Tag: {},
},
policy_B: {
Tag: {},
}
So, when we get the tag object values, we get [{Tag: {}}, {Tag: {}}]
instead of [{name: "Tag", orderWeight: 0, required: false, tags: {...}}]
.
We need to default to -1 here so it won't fetch the whole collection of tag. If it's -1, then the policyTagList
will be undefined and the array will be empty.
https://github.com/Expensify/App/blob/cf897a002e8949eb429026a020f23f92c2de6bee/src/components/ReportActionItem/MoneyRequestView.tsx#L692-L694
We can default to -1 for other onyx data in the file too. https://github.com/Expensify/App/blob/cf897a002e8949eb429026a020f23f92c2de6bee/src/components/ReportActionItem/MoneyRequestView.tsx#L686-L697
@johncschuster Whoops! This issue is 2 days overdue. Let's get this updated quick!
Job added to Upwork: https://www.upwork.com/jobs/~01374ae222703cc250
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (External
)
@bernhardoj's proposal looks good!
🎀 👀 🎀 C+ reviewed
Triggered auto assignment to @chiragsalian, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Proposal LGTM. Feel free to create the PR @bernhardoj. Also add a comment explaining why the default is -1 otherwise, it could be confusing for someone looking at the code
PR is ready
cc: @thesahindia
Contributor: @bernhardoj owed $250 via NewDot Contributor+: @thesahindia owed $250 via NewDot
@bernhardoj / @thesahindia do do we need regression test steps? If so, can you provide them?
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.21-0 Reproducible in staging?: Y Reproducible in production?: Y Issue was found when executing this PR https://github.com/Expensify/App/pull/47398 Email or phone of affected tester (no customers): applausetester+gm103030@applause.expensifail.com Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
App should not crash
Actual Result:
App crashes when admin pay elsewhere
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/0269fd43-9a19-4270-bc67-25165b1996eb
1608_1.txt
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @thesahindia