fix(frontend): add support for step id change for forloops and branch… (#4395)

* fix(frontend): add support for step id change for forloops and branchone + add initial value for DebounchedInput

* fix(frontend): fix initial value of DebouncedInput
This commit is contained in:
Faton Ramadani
2024-09-16 23:12:23 +02:00
committed by GitHub
parent d57b139df2
commit 97839a3583
2 changed files with 17 additions and 0 deletions
@@ -1,4 +1,5 @@
<script lang="ts">
import { onMount } from 'svelte'
import { twMerge } from 'tailwind-merge'
export let placeholder: string = 'Search...'
@@ -11,6 +12,7 @@
export { parentClass as class }
let timer: NodeJS.Timeout
let inputElement: HTMLInputElement | null = null
function debounce(event: KeyboardEvent): void {
clearTimeout(timer)
@@ -20,9 +22,16 @@
value = target.value
}, debounceDelay)
}
onMount(() => {
if (inputElement && value !== undefined) {
inputElement.value = value
}
})
</script>
<input
bind:this={inputElement}
{placeholder}
on:pointerdown|stopPropagation
on:keyup={debounce}
@@ -348,6 +348,14 @@
}
})
)
} else if (mod?.value?.type === 'forloopflow') {
if (mod.value.iterator.type === 'javascript') {
mod.value.iterator.expr = replaceId(mod.value.iterator.expr, id, newId)
}
} else if (mod?.value?.type === 'branchone') {
mod.value.branches.forEach((branch) => {
branch.expr = replaceId(branch.expr, id, newId)
})
}
})
}