Skip to content

Conversation

@midzelis
Copy link
Collaborator

@midzelis midzelis commented Dec 6, 2025

A PreloadManager that allows a use to preload images using AssetResponseDto objects - uses same algorithm as photo-viewer.svelte (which will be replaced to use $lib/utils soon)

In secure contexts, the SW will be used to preload images, and cancelation is supported. In non-secure contexts, a detached Image object is used to load/cache the images, and cancelation is not supported.

Stacked on #24898

@midzelis midzelis marked this pull request as draft December 23, 2025 04:36
@midzelis midzelis changed the title feat: PreloadManager feat: PreloadManager - improve perf and standardize preloading behavior Dec 28, 2025
@midzelis midzelis changed the base branch from main to push-lstprvkrupyq December 28, 2025 14:42
@midzelis midzelis added the stacked-pr Indicates a PR that has been stacked on another PR label Dec 28, 2025
@midzelis midzelis changed the title feat: PreloadManager - improve perf and standardize preloading behavior feat: improve perf and standardize preloading behavior Dec 28, 2025
@midzelis midzelis changed the title feat: improve perf and standardize preloading behavior feat: improve asset-viewer next/prev perf and standardize preloading behavior Dec 28, 2025
@midzelis midzelis marked this pull request as ready for review December 29, 2025 01:03
Base automatically changed from push-lstprvkrupyq to main December 29, 2025 15:28
@github-actions
Copy link
Contributor

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

Comment on lines +71 to +84
const getNextAsset = async (currentAsset: AssetResponseDto | undefined, preload: boolean = true) => {
if (!currentAsset) {
return;
}
const cursor = viewingAssets.indexOf(currentAsset.id);
if (cursor < viewingAssets.length - 1) {
const id = viewingAssets[cursor + 1];
const asset = await getAssetInfo({ ...authManager.params, id });
if (preload) {
void getNextAsset(asset, false);
}
return asset;
}
};
Copy link
Member

Choose a reason for hiding this comment

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

Duplicate code with large-file page. Is this intended?

@alextran1502
Copy link
Member

One immediate concern I have is that the usage of getNextAsset and getPreviousAsset is spread across multiple places.

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

Labels

changelog:skip preview stacked-pr Indicates a PR that has been stacked on another PR 🖥️web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants