diff --git a/src/UI/Studio/CollapsedTagRenderingPreview.svelte b/src/UI/Studio/CollapsedTagRenderingPreview.svelte index 2552f66997..1cc0ad2a85 100644 --- a/src/UI/Studio/CollapsedTagRenderingPreview.svelte +++ b/src/UI/Studio/CollapsedTagRenderingPreview.svelte @@ -39,16 +39,20 @@ } function fusePath(subpartPath: string[]): (string | number)[] { - const newPath = [...path] - const toAdd = [...subpartPath] - for (const part of path) { - if (toAdd[0] === part) { - toAdd.splice(0, 1) - } else { - break + const newPath = [...path] // has indices, e.g. ["A", 1, "B", "C", 2] + const toAdd = [...subpartPath] // doesn't have indices, e.g. ["A", "B", "C", "D"] + + let indexInToAdd = 0 + for (let i = 0; i < newPath.length; i++) { + if(newPath[i] === toAdd[indexInToAdd]){ + indexInToAdd ++ } } - newPath.push(...toAdd) + + // indexToAdd should now point to the last common index, '2' in the example + const resting = toAdd.slice(indexInToAdd) + + newPath.push(...resting) return newPath } diff --git a/src/UI/Studio/EditLayerState.ts b/src/UI/Studio/EditLayerState.ts index 871b75f173..2288034367 100644 --- a/src/UI/Studio/EditLayerState.ts +++ b/src/UI/Studio/EditLayerState.ts @@ -204,7 +204,7 @@ export abstract class EditJsonState { for (let i = 0; i < path.length - 1; i++) { const breadcrumb = path[i] - if (entry[breadcrumb] === undefined) { + if (entry[breadcrumb] === undefined || entry[breadcrumb] === null) { if (isUndefined) { // we have a dead end _and_ we do not need to set a value - we do an early return return diff --git a/src/UI/Studio/SchemaBasedArray.svelte b/src/UI/Studio/SchemaBasedArray.svelte index ca874a262b..f61b15495e 100644 --- a/src/UI/Studio/SchemaBasedArray.svelte +++ b/src/UI/Studio/SchemaBasedArray.svelte @@ -105,7 +105,7 @@ {/each} {:else} - + {#each $currentValue as value, i}