Fixed create task bug (#3308)

This commit is contained in:
Lucas Bordeau
2024-01-08 20:56:38 +01:00
committed by GitHub
parent 67b14824a4
commit dc94d26997
5 changed files with 40 additions and 14 deletions

View File

@ -13,6 +13,7 @@ import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { isNonEmptyArray } from '~/utils/isNonEmptyArray';
import { activityTargetableEntityArrayState } from '../states/activityTargetableEntityArrayState';
import { viewableActivityIdState } from '../states/viewableActivityIdState';
@ -79,7 +80,9 @@ export const useOpenCreateActivityDrawer = () => {
},
);
await createManyActivityTargets(activityTargetsToCreate);
if (isNonEmptyArray(activityTargetsToCreate)) {
await createManyActivityTargets(activityTargetsToCreate);
}
setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
setViewableActivityId(createdActivity.id);