Merge pull request #10992 from Budibase/fix/disable-looping-button

Fix duplicate loop block issue
This commit is contained in:
Peter Clement 2023-06-28 12:58:51 +01:00 committed by GitHub
commit 0114710332
1 changed files with 2 additions and 9 deletions

View File

@ -78,9 +78,6 @@
} }
async function removeLooping() { async function removeLooping() {
let loopBlock = $selectedAutomation?.definition.steps.find(
x => x.blockToLoop === block.id
)
try { try {
await automationStore.actions.deleteAutomationBlock(loopBlock) await automationStore.actions.deleteAutomationBlock(loopBlock)
} catch (error) { } catch (error) {
@ -89,10 +86,6 @@
} }
async function deleteStep() { async function deleteStep() {
let loopBlock = $selectedAutomation?.definition.steps.find(
x => x.blockToLoop === block.id
)
try { try {
if (loopBlock) { if (loopBlock) {
await automationStore.actions.deleteAutomationBlock(loopBlock) await automationStore.actions.deleteAutomationBlock(loopBlock)
@ -168,8 +161,8 @@
$automationStore.blockDefinitions.ACTION.LOOP.schema.inputs $automationStore.blockDefinitions.ACTION.LOOP.schema.inputs
.properties .properties
)} )}
block={loopBlock}
{webhookModal} {webhookModal}
block={loopBlock}
/> />
</Layout> </Layout>
</div> </div>
@ -191,7 +184,7 @@
{#if !isTrigger} {#if !isTrigger}
<div> <div>
<div class="block-options"> <div class="block-options">
{#if block?.features?.[Features.LOOPING] || !block.features} {#if !loopBlock && (block?.features?.[Features.LOOPING] || !block.features)}
<ActionButton on:click={() => addLooping()} icon="Reuse"> <ActionButton on:click={() => addLooping()} icon="Reuse">
Add Looping Add Looping
</ActionButton> </ActionButton>