fix(web): show correct assets in memory gallery (#26157)

This commit is contained in:
Michel Heusschen 2026-02-12 17:17:09 +01:00 committed by GitHub
parent 9f6dbf710c
commit 1cf3a80840
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View file

@ -68,7 +68,8 @@
let currentMemoryAssetFull = $derived.by(async () => let currentMemoryAssetFull = $derived.by(async () =>
current?.asset ? await getAssetInfo({ ...authManager.params, id: current.asset.id }) : undefined, current?.asset ? await getAssetInfo({ ...authManager.params, id: current.asset.id }) : undefined,
); );
let currentTimelineAssets = $derived([ let currentTimelineAssets = $derived(current?.memory.assets ?? []);
let viewerAssets = $derived([
...(current?.previousMemory?.assets ?? []), ...(current?.previousMemory?.assets ?? []),
...(current?.memory.assets ?? []), ...(current?.memory.assets ?? []),
...(current?.nextMemory?.assets ?? []), ...(current?.nextMemory?.assets ?? []),
@ -657,6 +658,7 @@
> >
<GalleryViewer <GalleryViewer
assets={currentTimelineAssets} assets={currentTimelineAssets}
{viewerAssets}
viewport={galleryViewport} viewport={galleryViewport}
{assetInteraction} {assetInteraction}
slidingWindowOffset={viewerHeight} slidingWindowOffset={viewerHeight}

View file

@ -34,6 +34,7 @@
type Props = { type Props = {
assets: AssetResponseDto[]; assets: AssetResponseDto[];
viewerAssets?: AssetResponseDto[];
assetInteraction: AssetInteraction; assetInteraction: AssetInteraction;
disableAssetSelect?: boolean; disableAssetSelect?: boolean;
showArchiveIcon?: boolean; showArchiveIcon?: boolean;
@ -48,6 +49,7 @@
let { let {
assets = $bindable(), assets = $bindable(),
viewerAssets,
assetInteraction, assetInteraction,
disableAssetSelect = false, disableAssetSelect = false,
showArchiveIcon = false, showArchiveIcon = false,
@ -61,6 +63,7 @@
}: Props = $props(); }: Props = $props();
let { isViewing: isViewerOpen, asset: viewingAsset } = assetViewingStore; let { isViewing: isViewerOpen, asset: viewingAsset } = assetViewingStore;
const navigationAssets = $derived(viewerAssets ?? assets);
const geometry = $derived( const geometry = $derived(
getJustifiedLayoutFromAssets(assets, { getJustifiedLayoutFromAssets(assets, {
@ -282,12 +285,12 @@
); );
const handleRandom = async (): Promise<{ id: string } | undefined> => { const handleRandom = async (): Promise<{ id: string } | undefined> => {
if (assets.length === 0) { if (navigationAssets.length === 0) {
return; return;
} }
try { try {
const randomIndex = Math.floor(Math.random() * assets.length); const randomIndex = Math.floor(Math.random() * navigationAssets.length);
const asset = assets[randomIndex]; const asset = navigationAssets[randomIndex];
await navigateToAsset(asset); await navigateToAsset(asset);
return asset; return asset;
@ -344,8 +347,8 @@
const assetCursor = $derived({ const assetCursor = $derived({
current: $viewingAsset, current: $viewingAsset,
nextAsset: getNextAsset(assets, $viewingAsset), nextAsset: getNextAsset(navigationAssets, $viewingAsset),
previousAsset: getPreviousAsset(assets, $viewingAsset), previousAsset: getPreviousAsset(navigationAssets, $viewingAsset),
}); });
</script> </script>