Skip to content

Commit

Permalink
fix: some edge cases for lower/upper case poracle names
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Sep 12, 2023
1 parent 04734f1 commit b7bec6b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/components/layout/dialogs/webhooks/human/area/AreaChip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,27 @@ export const handleClick =
children: [],
group: '',
}
const withLowerCase = {
group: foundGroup.group,
children: foundGroup.children.map((a) => a.toLowerCase()),
}

let newAreas = []
if (incomingArea === 'all') {
newAreas = groupName
? [
...existing,
...(areas.find((group) => group.group === groupName)?.children ||
[]),
]
newAreas = withLowerCase.group
? [...existing, ...withLowerCase.children]
: areas.flatMap((group) => group.children)
} else if (incomingArea === 'none') {
newAreas = groupName
? existing.filter((a) => !foundGroup.children.includes(a))
? existing.filter((a) => !withLowerCase.children.includes(a))
: []
} else {
newAreas = existing.includes(incomingArea)
? existing.filter((a) => a !== incomingArea)
: [...existing, incomingArea]
}
newAreas = [...new Set(newAreas)]

await apolloClient
.mutate({
mutation: setHuman,
Expand Down

0 comments on commit b7bec6b

Please sign in to comment.