fix iter reactivity

This commit is contained in:
Ruben Fiszel
2023-07-13 20:32:43 +02:00
parent 1e47b1a43f
commit d70699e0d2
2 changed files with 9 additions and 5 deletions
@@ -182,7 +182,8 @@
$state = $state
const job = generateNextFrontendJobId()
$jobs = [{ job, component: id, result: r }, ...$jobs]
const njobs = [{ job, component: id, result: r }, ...$jobs]
$jobs = $jobs?.length > 100 ? njobs.slice(0, 100) : njobs
} catch (e) {
sendUserToast(`Error running frontend script ${id}: ` + e.message, true)
@@ -264,7 +265,8 @@
})
})
if (njob) {
$jobs = [{ job: njob, component: id }, ...$jobs]
const njobs = [{ job: njob, component: id }, ...$jobs]
$jobs = $jobs?.length > 100 ? njobs.slice(0, 100) : njobs
}
} catch (e) {
setResult({ error: e.body ?? e.message }, undefined)
@@ -428,7 +430,7 @@
{#if v.type != 'static' && v.type != 'user'}
<InputValue
bind:this={inputValues[key]}
key={key + extraKey}
key={key + extraKey + (iterContext ? $iterContext?.index : '')}
{id}
input={fields[key]}
bind:value={runnableInputValues[key]}
@@ -438,7 +440,7 @@
{#if runnable?.type == 'runnableByName' && runnable.inlineScript?.language == 'frontend'}
{#each runnable.inlineScript.refreshOn ?? [] as { id: tid, key } (`${tid}-${key}`)}
{@const fkey = `${tid}-${key}${extraKey}`}
{@const fkey = `${tid}-${key}${extraKey}${iterContext ? $iterContext?.index : ''}}`}
<InputValue
{id}
key={fkey}
@@ -799,7 +799,9 @@
<div class="flex flex-row gap-1 items-center">
<Bug size={14} />
<div> Debug runs</div>
<div class="text-2xs text-gray-500">({$jobs?.length ?? 0})</div>
<div class="text-2xs text-gray-500"
>({$jobs?.length > 99 ? '99+' : $jobs?.length ?? 0})</div
>
{#if hasErrors}
<Button
size="xs"