2
0

🐛 (typebotLink) Fix typebotIds infinite query param

This commit is contained in:
Baptiste Arnaud
2023-02-15 16:10:32 +01:00
parent 44d7740952
commit 2f7e71f66e
3 changed files with 25 additions and 61 deletions

View File

@ -124,16 +124,18 @@ export const TypebotProvider = ({
},
] = useUndo<Typebot | undefined>(undefined)
const linkedTypebotIds = localTypebot?.groups
.flatMap((b) => b.blocks)
.reduce<string[]>(
(typebotIds, block) =>
block.type === LogicBlockType.TYPEBOT_LINK &&
isDefined(block.options.typebotId)
? [...typebotIds, block.options.typebotId]
: typebotIds,
[]
)
const linkedTypebotIds =
localTypebot?.groups
.flatMap((b) => b.blocks)
.reduce<string[]>(
(typebotIds, block) =>
block.type === LogicBlockType.TYPEBOT_LINK &&
isDefined(block.options.typebotId) &&
!typebotIds.includes(block.options.typebotId)
? [...typebotIds, block.options.typebotId]
: typebotIds,
[]
) ?? []
const { typebots: linkedTypebots } = useLinkedTypebots({
workspaceId: localTypebot?.workspaceId ?? undefined,