2
0

👷 Transpile components for better DX

This commit is contained in:
Baptiste Arnaud
2022-09-18 09:46:42 +02:00
committed by Baptiste Arnaud
parent 898367a33b
commit c1dd4d403e
147 changed files with 343 additions and 485 deletions

View File

@ -138,16 +138,26 @@ const duplicateBlockDraft =
(groupId: string) =>
(block: Block): Block => {
const blockId = cuid()
if (blockHasItems(block))
return {
...block,
groupId,
id: blockId,
items: block.items.map(duplicateItemDraft(blockId)),
outgoingEdgeId: undefined,
} as Block
if (isWebhookBlock(block))
return {
...block,
groupId,
id: blockId,
webhookId: cuid(),
outgoingEdgeId: undefined,
}
return {
...block,
groupId,
id: blockId,
items: blockHasItems(block)
? block.items.map(duplicateItemDraft(blockId))
: undefined,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
webhookId: isWebhookBlock(block) ? cuid() : undefined,
outgoingEdgeId: undefined,
}
}