Fix delete

This commit is contained in:
Mel O'Hagan 2022-08-25 19:07:13 +01:00
parent c8330622e3
commit dd8b116a91
1 changed files with 15 additions and 12 deletions

View File

@ -67,7 +67,7 @@
{/if} {/if}
{:else if schema.type === QueryTypes.FLOW} {:else if schema.type === QueryTypes.FLOW}
<br /> <br />
{#if query.fields.steps?.length == 0} {#if (query.fields.steps?.length ?? 0) === 0}
<div class="controls"> <div class="controls">
<Button <Button
secondary secondary
@ -93,9 +93,8 @@
Stage {index + 1} Stage {index + 1}
<ActionButton <ActionButton
on:click={() => { on:click={() => {
query.fields.steps = [ query.fields.steps.splice(index, 1)
...query.fields.steps.splice(index, 1), query.fields.steps = query.fields.steps
]
}} }}
icon="DeleteOutline" icon="DeleteOutline"
/> />
@ -109,14 +108,18 @@
query.fields.steps[index].key = detail query.fields.steps[index].key = detail
}} }}
/> />
<Editor {#key query.fields.steps.length}
editorHeight={height / 2} <Editor
mode="json" editorHeight={height / 2}
value={step.value} mode="json"
on:change={({ detail }) => { value={typeof step.value === "string"
query.fields.steps[index].value = detail ? step.value
}} : step.value.value}
/> on:change={({ detail }) => {
query.fields.steps[index].value = detail
}}
/>
{/key}
</div> </div>
</div> </div>
</Layout> </Layout>