Pass empty arrays instead of undefined
This commit is contained in:
parent
f08f719350
commit
63d07f79f6
|
@ -162,11 +162,13 @@ export async function removeContractFromGroup(
|
||||||
) {
|
) {
|
||||||
if (!contract.groupLinks?.map((l) => l.groupId).includes(group.id)) return // not in that group
|
if (!contract.groupLinks?.map((l) => l.groupId).includes(group.id)) return // not in that group
|
||||||
|
|
||||||
const newGroupLinks =
|
const newGroupLinks = contract.groupLinks?.filter(
|
||||||
contract.groupLinks?.filter((link) => link.slug !== group.slug) ?? []
|
(link) => link.slug !== group.slug
|
||||||
|
)
|
||||||
await updateContract(contract.id, {
|
await updateContract(contract.id, {
|
||||||
groupSlugs: contract.groupSlugs?.filter((slug) => slug !== group.slug),
|
groupSlugs:
|
||||||
groupLinks: newGroupLinks,
|
contract.groupSlugs?.filter((slug) => slug !== group.slug) ?? [],
|
||||||
|
groupLinks: newGroupLinks ?? [],
|
||||||
})
|
})
|
||||||
const newContractIds = group.contractIds.filter((id) => id !== contract.id)
|
const newContractIds = group.contractIds.filter((id) => id !== contract.id)
|
||||||
return await updateGroup(group, {
|
return await updateGroup(group, {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user