Fix: schemaBasedArray

This commit is contained in:
Pieter Vander Vennet 2023-11-12 13:49:39 +01:00
parent f8fa1841e4
commit a7599f6d7f

View file

@ -64,7 +64,7 @@
} }
} }
newPath.push(...toAdd) newPath.push(...toAdd)
console.log({ newPath }) console.log("Fused path ", path.join("."), "+", i,"+", subpartPath.join("."),"into",newPath.join("."))
return newPath return newPath
} }
@ -115,7 +115,7 @@
<!-- We need an array of values, so we use the typehint of the _parent_ element as field --> <!-- We need an array of values, so we use the typehint of the _parent_ element as field -->
{#each $currentValue as value, i} {#each $currentValue as value, i}
<div class="flex w-full"> <div class="flex w-full">
<SchemaBasedField {state} {schema} path={[...path, i]} /> <SchemaBasedField {state} {schema} path={fusePath(i, [])} />
<button <button
class="h-fit w-fit rounded-full border border-black p-1" class="h-fit w-fit rounded-full border border-black p-1"
on:click={() => { on:click={() => {
@ -143,7 +143,7 @@
{/if} {/if}
<div class="border border-black"> <div class="border border-black">
{#if isTagRenderingBlock} {#if isTagRenderingBlock}
<QuestionPreview {state} path={[...path, i]} {schema}> <QuestionPreview {state} path={fusePath(i, [])} {schema}>
<button <button
on:click={() => { on:click={() => {
del(i) del(i)
@ -191,7 +191,7 @@
<SchemaBasedMultiType {state} path={fusePath(i, [])} schema={schemaForMultitype()} /> <SchemaBasedMultiType {state} path={fusePath(i, [])} schema={schemaForMultitype()} />
{:else} {:else}
{#each subparts as subpart} {#each subparts as subpart}
<SchemaBasedInput {state} path={fusePath(i, subpart.path)} schema={subpart} /> <SchemaBasedInput {state} path={fusePath(i, [subpart.path.at(-1)])} schema={subpart} />
{/each} {/each}
{/if} {/if}
</div> </div>