Skip to content

Commit

Permalink
Merge pull request #47232 from ShridharGoel/patch-19
Browse files Browse the repository at this point in the history
[InternalQA] Fix crash when disconnecting from Netsuite
  • Loading branch information
marcaaron authored Nov 8, 2024
2 parents 9dc6a97 + 02d6c4f commit e4cdb42
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -682,9 +682,12 @@ function MoneyRequestConfirmationList({
useEffect(() => {
let updatedTagsString = TransactionUtils.getTag(transaction);
policyTagLists.forEach((tagList, index) => {
const enabledTags = Object.values(tagList.tags).filter((tag) => tag.enabled);
const isTagListRequired = tagList.required ?? false;
if (!isTagListRequired || enabledTags.length !== 1 || TransactionUtils.getTag(transaction, index)) {
if (!isTagListRequired) {
return;
}
const enabledTags = Object.values(tagList.tags).filter((tag) => tag.enabled);
if (enabledTags.length !== 1 || TransactionUtils.getTag(transaction, index)) {
return;
}
updatedTagsString = IOUUtils.insertTagIntoTransactionTagsString(updatedTagsString, enabledTags.at(0)?.name ?? '', index);
Expand Down
5 changes: 4 additions & 1 deletion src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,10 @@ function getTagListSections(
* Verifies that there is at least one enabled tag
*/
function hasEnabledTags(policyTagList: Array<PolicyTagLists[keyof PolicyTagLists]>) {
const policyTagValueList = policyTagList.map(({tags}) => Object.values(tags)).flat();
const policyTagValueList = policyTagList
.filter((tag) => tag && tag.tags)
.map(({tags}) => Object.values(tags))
.flat();

return hasEnabledOptions(policyTagValueList);
}
Expand Down

0 comments on commit e4cdb42

Please sign in to comment.