|
26 | 26 | import { searchStore } from '$lib/stores/search.svelte';
|
27 | 27 | import { featureFlags } from '$lib/stores/server-config.store';
|
28 | 28 | import { handlePromiseError } from '$lib/utils';
|
29 |
| - import { deleteAssets, updateStackedAssetInTimeline, updateUnstackedAssetInTimeline } from '$lib/utils/actions'; |
| 29 | + import { |
| 30 | + deleteAssets, |
| 31 | + refreshStackedAssetInTimeline, |
| 32 | + updateStackedAssetInTimeline, |
| 33 | + updateUnstackedAssetInTimeline, |
| 34 | + } from '$lib/utils/actions'; |
30 | 35 | import { archiveAssets, cancelMultiselect, selectAllAssets, stackAssets } from '$lib/utils/asset-utils';
|
31 | 36 | import { navigate } from '$lib/utils/navigation';
|
32 | 37 | import {
|
|
526 | 531 | case AssetAction.REMOVE_ASSET_FROM_STACK: {
|
527 | 532 | timelineManager.addAssets([toTimelineAsset(action.asset)]);
|
528 | 533 | if (action.stack) {
|
529 |
| - //Have to unstack then restack assets in timeline in order to update the stack count in the timeline. |
530 |
| - updateUnstackedAssetInTimeline( |
531 |
| - timelineManager, |
532 |
| - action.stack.assets.map((asset) => toTimelineAsset(asset)), |
533 |
| - ); |
534 |
| - updateStackedAssetInTimeline(timelineManager, { |
535 |
| - stack: action.stack, |
536 |
| - toDeleteIds: action.stack.assets |
537 |
| - .filter((asset) => asset.id !== action.stack?.primaryAssetId) |
538 |
| - .map((asset) => asset.id), |
539 |
| - }); |
| 534 | + refreshStackedAssetInTimeline(timelineManager, action.stack); |
540 | 535 | }
|
541 | 536 | break;
|
542 | 537 | }
|
543 | 538 | case AssetAction.SET_STACK_PRIMARY_ASSET: {
|
544 |
| - //Have to unstack then restack assets in timeline in order for the currently removed new primary asset to be made visible. |
545 |
| - updateUnstackedAssetInTimeline( |
546 |
| - timelineManager, |
547 |
| - action.stack.assets.map((asset) => toTimelineAsset(asset)), |
548 |
| - ); |
549 |
| - updateStackedAssetInTimeline(timelineManager, { |
550 |
| - stack: action.stack, |
551 |
| - toDeleteIds: action.stack.assets |
552 |
| - .filter((asset) => asset.id !== action.stack.primaryAssetId) |
553 |
| - .map((asset) => asset.id), |
554 |
| - }); |
| 539 | + refreshStackedAssetInTimeline(timelineManager, action.stack, true); |
555 | 540 | break;
|
556 | 541 | }
|
557 | 542 | }
|
|
0 commit comments