So I currently have a svelte tree view in which the data for the parent component is being fetched from API at first, and then any other child element is pulled from the parent's id.
parent.svelte
const let projects = [] \\ being fetch through API
{#each project as project}
<TreeView children={project}>
{/each}
TreeView.svelte
export let children = '';
{#if expanded}
{#await pull_all_children(project.id)}
<p>Loading</p>
{:then children}
{#each children as child}
<svelte:self children={child}/>
{/each}
{/await}
{/if}
The tree view looks good so far, and im getting the tree, but I want to be able to click on a child and return to the root.
So something like this root->child1->child3, can anyone guide me on what steps I should take to achieve this? Also, if you see some fix on my logic above, im all ears.