live = true;
});
let tree = $state<HTMLElement>();
// the tree holds the height it had before the filter, so filtering doesn't move the page
let treeHeight = $state(0);
let unfiltered = $state(0);
$effect(() => {
const body = tree?.closest<HTMLElement>(".sb-tree");
if (filter || !body) return;
// only what the window shows of it, so a filtered tree doesn't scroll on into nothing
const { paddingTop, paddingBottom } = getComputedStyle(body);
const shown = body.clientHeight - parseFloat(paddingTop) - parseFloat(paddingBottom);
unfiltered = Math.min(treeHeight, shown);
});
// the filter and the scroll carry over to the next page of this repo and ref
const repoPath = $derived(`/${repo.ownerHandle}/${repo.name}`);
onMount(() => {
115 unmodified lines
Expand all
/>
</header>
{/snippet}
{#if rootEntries && (root !== "" || rootEntries.length > 0)}
<div bind:this={tree}>
<div
bind:this={tree}
bind:offsetHeight={treeHeight}
style:min-height={filter && unfiltered ? `${unfiltered}px` : undefined}
>
<TreeList
ownerHandle={repo.ownerHandle}
repoName={repo.name}
ref={sidebar.ref}
109 unmodified lines
Expand all