♻️ Use at function instead of dangerous direct lookup array index

This commit is contained in:
Baptiste Arnaud
2024-03-04 14:14:06 +01:00
parent a043c3e4b9
commit 4ca613e83a
6 changed files with 37 additions and 31 deletions

View File

@@ -58,6 +58,10 @@ export const PictureChoiceItemNode = ({
}
useEventListener('wheel', handleMouseWheel, ref.current)
const blockId = typebot
? typebot.groups.at(indices.groupIndex)?.blocks?.at(indices.blockIndex)?.id
: undefined
return (
<Popover
placement="right"
@@ -132,15 +136,12 @@ export const PictureChoiceItemNode = ({
shadow="lg"
ref={ref}
>
{typebot && (
{typebot && blockId && (
<PictureChoiceItemSettings
workspaceId={typebot.workspaceId}
typebotId={typebot.id}
item={item}
blockId={
typebot.groups[indices.groupIndex].blocks[indices.blockIndex]
.id
}
blockId={blockId}
onItemChange={handleItemChange}
/>
)}