mirror of
https://github.com/immich-app/immich.git
synced 2026-03-01 01:59:06 +03:00
fix: correctly cancel select all assets (#26067)
This commit is contained in:
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user