Adding to nested JSON using svelte:self?

I’m trying to target nested JSON using svelte:self and encountering an issue where adding to the JSON will result in any newly added entries being deleted if they occur lower down the tree in the JSON structure. Here’s an example REPL using the svelte:self demo. I’m clearly missing something with how I’ve specified where to add within the JSON?

let files = [
    name: 'entry 1',
    files: [
        name: 'nested entry' 
    name: 'entry 2' 

function add() {
  files = files.concat({name: 'new item'})

{#each files as file}
  {#if file.files}
    <svelte:self {...file}/>
    <File {...file}/>
  <button on:click={() => add()}>new</button>


Instead of spreading the props in <svelte:self {...file}> setting them seperately and adding ‘bind:’ to the files there and in the main <Folder ..> tag seems to solve the unwanted deletions -> [REPL] (

<Folder name="Home" bind:files={root} expanded/>
<svelte:self name={} bind:files={file.files}/>