Skip to content

High performance self-hosted photo and video management solution.

fix(web): limit max height of search results (#20727)

Thomas746252fe39e1
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 30e14abc59..fad053fc67 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,12 +145,13 @@
let lastIntersectedHeight = 0;
$effect(() => {
- // notify we got to (near) the end of scroll
- const scrollPercentage =
- ((slidingWindow.bottom - viewport.height) / (viewport.height - (document.scrollingElement?.clientHeight || 0))) *
- 100;
+ const scrollRatio = slidingWindow.bottom / assetLayouts.containerHeight;
- if (scrollPercentage > 90) {
+ // 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) {
+ // Notify we got to (near) the end of scroll.
const intersectedHeight = geometry?.containerHeight || 0;
if (lastIntersectedHeight !== intersectedHeight) {
debouncedOnIntersected();
diff --git a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte
index b3177fc39e..56e58c3633 100644
--- a/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte
+++ b/web/src/routes/(user)/search/[[photos=photos]]/[[assetId=id]]/+page.svelte
@@ -360,7 +360,7 @@
{/if}
<section
- class="mb-12 bg-immich-bg dark:bg-immich-dark-bg m-4"
+ class="mb-12 bg-immich-bg dark:bg-immich-dark-bg m-4 max-h-screen"
bind:clientHeight={viewport.height}
bind:clientWidth={viewport.width}
bind:this={searchResultsElement}