mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 22:30:41 +08:00
Move AppSidebar out of per-route view components into App.svelte so it
is never unmounted on navigation. This fixes the sidebar scroll position
resetting to the top whenever the user opens a repository or navigates
between Issues, Patches and the repo home view.
Also removes the redundant invoke<Config>("config") call from each repo
route loader — the value is now taken from sidebarData.config, which
loadSidebarData() already fetches.
40 lines
942 B
Svelte
40 lines
942 B
Svelte
<script lang="ts">
|
|
import type { Snippet } from "svelte";
|
|
|
|
import ScrollArea from "@app/components/ScrollArea.svelte";
|
|
|
|
interface Props {
|
|
children: Snippet;
|
|
loadMoreContent?: () => Promise<void>;
|
|
selfScroll?: boolean;
|
|
}
|
|
|
|
const {
|
|
children,
|
|
loadMoreContent = undefined,
|
|
selfScroll = false,
|
|
}: Props = $props();
|
|
|
|
let loadingContent = false;
|
|
</script>
|
|
|
|
{#if selfScroll}
|
|
<div
|
|
style="height: 100%; overflow: hidden; min-width: 0; background-color: var(--color-surface-canvas);">
|
|
{@render children()}
|
|
</div>
|
|
{:else}
|
|
<ScrollArea
|
|
style="height: 100%; width: 100%; background-color: var(--color-surface-canvas);"
|
|
onScrollHalf={loadMoreContent
|
|
? () => {
|
|
if (!loadingContent) {
|
|
loadingContent = true;
|
|
void loadMoreContent().finally(() => (loadingContent = false));
|
|
}
|
|
}
|
|
: undefined}>
|
|
{@render children()}
|
|
</ScrollArea>
|
|
{/if}
|