Fix patches list pagination

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.
This commit is contained in:
Rūdolfs Ošiņš
2026-07-03 11:25:35 +02:00
parent b99d656c81
commit a07787c2c6
3 changed files with 68 additions and 97 deletions
+1 -28
View File
@@ -20,36 +20,12 @@
interface Props {
children: Snippet;
style?: string;
onScrollHalf?: () => void;
}
const {
children,
style = "height: 100%;",
onScrollHalf = undefined,
}: Props = $props();
const { children, style = "height: 100%;" }: Props = $props();
let viewport: HTMLElement | undefined = $state(undefined);
setContext(SCROLL_VIEWPORT_CONTEXT, () => viewport);
function shouldLoadMore(instance: {
elements(): { target: HTMLElement };
}): boolean {
const el = instance.elements().target;
const threshold = 200;
return el.scrollTop + el.clientHeight >= el.scrollHeight - threshold;
}
const scrollHalfHandler = $derived(
onScrollHalf
? (instance: Parameters<typeof shouldLoadMore>[0]) => {
if (shouldLoadMore(instance)) {
onScrollHalf();
}
}
: undefined,
);
</script>
<OverlayScrollbarsComponent
@@ -61,10 +37,7 @@
events={{
initialized: instance => {
viewport = instance.elements().viewport;
scrollHalfHandler?.(instance);
},
scroll: scrollHalfHandler,
updated: scrollHalfHandler,
}}
defer>
{@render children()}