feat: duplicate groups

This commit is contained in:
Carlos Valente
2025-05-19 20:01:03 +02:00
committed by arc-alex
parent 11e0215530
commit 2f26f20db5
20 changed files with 448 additions and 88 deletions
@@ -20,6 +20,7 @@ import {
deleteEntries,
patchReorderEntry,
postAddEntry,
postCloneEntry,
putBatchEditEvents,
putEditEntry,
ReorderEntry,
@@ -164,6 +165,29 @@ export const useEntryActions = () => {
],
);
/**
* Calls mutation to clone a selection
* @private
*/
const _cloneMutation = useMutation({
mutationFn: postCloneEntry,
onSettled: () => queryClient.invalidateQueries({ queryKey: RUNDOWN }),
});
/**
* Clone a selection
*/
const clone = useCallback(
async (entryId: EntryId) => {
try {
await _cloneMutation.mutateAsync(entryId);
} catch (error) {
logAxiosError('Error cloning entry', error);
}
},
[_cloneMutation],
);
/**
* Calls mutation to update existing entry
* @private
@@ -735,6 +759,7 @@ export const useEntryActions = () => {
addEntry,
applyDelay,
batchUpdateEvents,
clone,
deleteEntry,
deleteAllEntries,
dissolveBlock,