Skip to content

Commit

Permalink
only load/pin history if items were copied
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedhamidawan committed Sep 3, 2024
1 parent 43f3b8f commit c742333
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions client/src/composables/historyDragDrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,16 @@ export function useHistoryDragDrop(targetHistoryId?: Ref<string> | string, creat
);
}

if (pinHistories && historyStore.pinnedHistories.length > 0) {
// pin the target history
historyStore.pinHistory(historyId);
// also pin the original history where the item came from
historyStore.pinHistory(originalHistoryId);
} else {
historyStore.loadHistoryById(historyId);
// if items were copied
if (datasetCount > 0 && collectionCount > 0) {
if (pinHistories && historyStore.pinnedHistories.length > 0) {
// pin the target history
historyStore.pinHistory(historyId);
// also pin the original history where the item came from
historyStore.pinHistory(originalHistoryId);
} else {
historyStore.loadHistoryById(historyId);
}
}
} catch (error) {
Toast.error(`${error}`);
Expand Down

0 comments on commit c742333

Please sign in to comment.