mirror of
https://seed.radicle.dev/rad:z4D5UCArafTzTQpDZNQRuqswh3ury.git
synced 2026-11-12 06:40:40 +08:00
The patches list paged through everything without scrolling: ScrollArea fired its load-more check on every `updated` DOM event, and the list's min-height made the bottom threshold always true, so each appended page triggered the next. Move it to InfiniteScrollSentinel like the commits list.
45 lines
1.1 KiB
Svelte
45 lines
1.1 KiB
Svelte
<script lang="ts" module>
|
|
import { getContext } from "svelte";
|
|
|
|
const SCROLL_VIEWPORT_CONTEXT = Symbol("scroll-viewport");
|
|
|
|
export function getScrollViewport(): () => HTMLElement | undefined {
|
|
return (
|
|
getContext<() => HTMLElement | undefined>(SCROLL_VIEWPORT_CONTEXT) ??
|
|
(() => undefined)
|
|
);
|
|
}
|
|
</script>
|
|
|
|
<script lang="ts">
|
|
import type { Snippet } from "svelte";
|
|
|
|
import { OverlayScrollbarsComponent } from "overlayscrollbars-svelte";
|
|
import { setContext } from "svelte";
|
|
|
|
interface Props {
|
|
children: Snippet;
|
|
style?: string;
|
|
}
|
|
|
|
const { children, style = "height: 100%;" }: Props = $props();
|
|
|
|
let viewport: HTMLElement | undefined = $state(undefined);
|
|
setContext(SCROLL_VIEWPORT_CONTEXT, () => viewport);
|
|
</script>
|
|
|
|
<OverlayScrollbarsComponent
|
|
element="div"
|
|
{style}
|
|
options={{
|
|
scrollbars: { theme: "global-os-theme-radicle", autoHide: "scroll" },
|
|
}}
|
|
events={{
|
|
initialized: instance => {
|
|
viewport = instance.elements().viewport;
|
|
},
|
|
}}
|
|
defer>
|
|
{@render children()}
|
|
</OverlayScrollbarsComponent>
|