fix: correctly cancel select all assets (#26067)

This commit is contained in:
Michel Heusschen
2026-02-10 17:47:23 +01:00
committed by GitHub
parent e6e56d75e2
commit a9e0fa43fa
6 changed files with 18 additions and 31 deletions

View File

@@ -7,7 +7,6 @@ import type { TimelineAsset } from '$lib/managers/timeline-manager/types';
import { assetsSnapshot } from '$lib/managers/timeline-manager/utils.svelte';
import { Route } from '$lib/route';
import type { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
import { isSelectingAllAssets } from '$lib/stores/assets-store.svelte';
import { preferences } from '$lib/stores/user.store';
import { downloadRequest, withError } from '$lib/utils';
import { getByteUnitString } from '$lib/utils/byte-units';
@@ -427,17 +426,17 @@ export const keepThisDeleteOthers = async (keepAsset: AssetResponseDto, stack: S
};
export const selectAllAssets = async (timelineManager: TimelineManager, assetInteraction: AssetInteraction) => {
if (get(isSelectingAllAssets)) {
if (assetInteraction.selectAll) {
// Selection is already ongoing
return;
}
isSelectingAllAssets.set(true);
assetInteraction.selectAll = true;
try {
for (const monthGroup of timelineManager.months) {
await timelineManager.loadMonthGroup(monthGroup.yearMonth);
if (!get(isSelectingAllAssets)) {
if (!assetInteraction.selectAll) {
assetInteraction.clearMultiselect();
break; // Cancelled
}
@@ -450,12 +449,12 @@ export const selectAllAssets = async (timelineManager: TimelineManager, assetInt
} catch (error) {
const $t = get(t);
handleError(error, $t('errors.error_selecting_all_assets'));
isSelectingAllAssets.set(false);
assetInteraction.selectAll = false;
}
};
export const cancelMultiselect = (assetInteraction: AssetInteraction) => {
isSelectingAllAssets.set(false);
assetInteraction.selectAll = false;
assetInteraction.clearMultiselect();
};