fix reactivity bug with synchronous param

This commit is contained in:
Peter Clement 2023-05-26 13:18:08 +01:00
parent 9dc354c28b
commit 221d03c153
1 changed files with 7 additions and 13 deletions

View File

@ -7,8 +7,6 @@
export let parameters = {} export let parameters = {}
export let bindings = [] export let bindings = []
let synchronous = parameters.synchronous
const AUTOMATION_STATUS = { const AUTOMATION_STATUS = {
NEW: "new", NEW: "new",
EXISTING: "existing", EXISTING: "existing",
@ -20,14 +18,11 @@
$: { $: {
if (automationStatus === AUTOMATION_STATUS.NEW) { if (automationStatus === AUTOMATION_STATUS.NEW) {
synchronous = false parameters.synchronous = false
}
if (automationStatus === AUTOMATION_STATUS.EXISTING) {
synchronous = automations.find(
automation => automation._id === parameters.automationId
).synchronous
} }
parameters.synchronous = automations.find(
automation => automation._id === parameters.automationId
)?.synchronous
} }
$: automations = $automationStore.automations $: automations = $automationStore.automations
.filter(a => a.definition.trigger?.stepId === TriggerStepID.APP) .filter(a => a.definition.trigger?.stepId === TriggerStepID.APP)
@ -80,11 +75,10 @@
const onChange = value => { const onChange = value => {
let automationId = value.detail let automationId = value.detail
synchronous = automations.find( parameters.synchronous = automations.find(
automation => automation._id === automationId automation => automation._id === automationId
).synchronous )?.synchronous
parameters.automationId = automationId parameters.automationId = automationId
parameters.synchronous = synchronous
} }
</script> </script>
@ -128,7 +122,7 @@
/> />
{/if} {/if}
{#if synchronous} {#if parameters.synchronous}
<Label small /> <Label small />
<div class="synchronous-info"> <div class="synchronous-info">