Skip to content

feat: web - swipe feedback - show image while swiping/dragging left/right - #24904

Closed
midzelis wants to merge 6 commits into
refactor/adaptive_imagefrom
push-nwxlpmyzkyrl
Closed

midzelis wants to merge 6 commits into
refactor/adaptive_imagefrom
push-nwxlpmyzkyrl

Conversation

@midzelis

@midzelis midzelis commented Dec 28, 2025 •

Copy link
Copy Markdown
Collaborator

feat: web - swipe feedback - show image while swiping/dragging left/right

@github-actions

Copy link
Copy Markdown
Contributor

Deploying preview environment to https://pr-24904.preview.internal.immich.build/

@midzelis
midzelis marked this pull request as ready for review December 29, 2025 01:03
@midzelis
midzelis force-pushed the push-qtxrpwpzzmvv branch 2 times, most recently from 387dd5e to 457076f Compare January 8, 2026 01:13
Base automatically changed from push-qtxrpwpzzmvv to main January 15, 2026 11:55
@midzelis
midzelis force-pushed the push-nwxlpmyzkyrl branch 10 times, most recently from d6d7cbc to d138957 Compare January 22, 2026 03:45
@bo0tzz bo0tzz removed the preview label Jan 22, 2026
@midzelis
midzelis force-pushed the refactor/adaptive_image branch from 7139757 to 70953a5 Compare January 27, 2026 00:26
@midzelis
midzelis force-pushed the refactor/adaptive_image branch from 70953a5 to 49791dd Compare January 28, 2026 15:18
@immich-push-o-matic immich-push-o-matic Bot added documentation Improvements or additions to documentation 🧠machine-learning labels Feb 4, 2026
@midzelis
midzelis force-pushed the refactor/adaptive_image branch from 49791dd to f58dcb2 Compare February 4, 2026 03:34
@midzelis
midzelis force-pushed the refactor/adaptive_image branch from f58dcb2 to a705be8 Compare February 4, 2026 04:22
@midzelis
midzelis force-pushed the push-nwxlpmyzkyrl branch 2 times, most recently from 3e17d1a to 518dd89 Compare February 4, 2026 15:13
refactor: replace onPreviousAsset/onNextAsset with onSwipe
Comment on lines +208 to +216
const loader = new AdaptiveImageLoader(
asset,
undefined,
{
currentZoomFn: () => 1,
onQualityUpgrade: (url) => setPreviewUrl(direction, url),
},
loadImage,
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I literally have no idea what any of these parameters actually are without opening an IDE. I would much prefer if the class takes an object instead. (I'm aware that's a change in the previous PR, just noticed it here right now)

Comment on lines +250 to +253
// When moving forward: old next becomes current, shift preview URLs
const oldNextUrl = nextPreviewUrl;
destroyPreviousPreloader();
}

if (shouldDestroyNext) {
previousPreviewUrl = oldNextUrl;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're saying "old becomes current", which I agree with. However, you then set previousPreviewUrl = nextPreviewUrl. That's not right, is it?

Comment on lines 279 to 281
} else {
// Non-adjacent navigation (e.g., slideshow random)
previousPreloader = startPreloader(newCursor.previousAsset);
nextPreloader = startPreloader(newCursor.nextAsset);
return 'skip';
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to be in an else

imageClass="object-contain"
slideshowState={$slideshowState}
slideshowLook={$slideshowLook}
/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More comments for the adaptive-image PR. You're only passing in global state anyways; do you even need these props?

Comment on lines +10 to +11
onSwipeEnd?: (offsetX: number) => void;
onSwipeMove?: (offsetX: number) => void;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the use case for these props?

Comment on lines +17 to +18
clientWidth?: number;
clientHeight?: number;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we need those for? Especially when we already bind to element

clientWidth?: number;
clientHeight?: number;
reset?: () => void;
children: Snippet;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we need children for when we already bind to element? Really, a lot of these props feel either redundant or overly generic to me, could you please revisit them?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we even building our own swipe component? Surely there are already libraries for this out there

Comment on lines +74 to +78
const exifDimensions = $derived(
asset?.exifInfo?.exifImageHeight && asset?.exifInfo.exifImageHeight
? (getDimensions(asset.exifInfo) as { width: number; height: number })
: null,
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use the height and width on the asset instead, since that is also robust against edits (for whenever we get video edits)

video:focus {
outline: none;
}
</style>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we just put this on the component?

@jrasm91

jrasm91 commented Feb 17, 2026

Copy link
Copy Markdown
Member

This PR has a lot of issues, but the biggest issue is that it is way too big. Please submit pull requests that are of a reasonable size and scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants