Skip to content

High performance self-hosted photo and video management solution.

chore(web): make search result loading behaviour more consistent (#20741)

Thomas47566c1a4a19
diff --git a/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte b/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte
index fad053fc67..d369068a2c 100644
--- a/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte
+++ b/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte
@@ -145,14 +145,10 @@
let lastIntersectedHeight = 0;
$effect(() => {
- const scrollRatio = slidingWindow.bottom / assetLayouts.containerHeight;
-
- // TODO: We may want to limit to an absolute value as the ratio scaling will
- // get weird with lots of assets. The page may be nowhere near the bottom in
- // absolute terms, and yet the intersection will still be triggered.
- if (scrollRatio > 0.9) {
+ // Intersect if there's only one viewport worth of assets left to scroll.
+ if (assetLayouts.containerHeight - slidingWindow.bottom <= viewport.height) {
// Notify we got to (near) the end of scroll.
- const intersectedHeight = geometry?.containerHeight || 0;
+ const intersectedHeight = assetLayouts.containerHeight;
if (lastIntersectedHeight !== intersectedHeight) {
debouncedOnIntersected();
lastIntersectedHeight = intersectedHeight;