Skip to content

Commit

Permalink
refactor: use isDefined function instead of an explicit check with un…
Browse files Browse the repository at this point in the history
…defined
  • Loading branch information
Devessier committed Aug 29, 2024
1 parent ab696d5 commit 0a46f9b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '@/workflow/types/Workflow';
import { getWorkflowLastVersion } from '@/workflow/utils/getWorkflowLastVersion';
import { insertStep } from '@/workflow/utils/insertStep';
import { isDefined } from 'twenty-ui';

export const useCreateNode = ({ workflow }: { workflow: Workflow }) => {
const { updateOneRecord: updateOneWorkflowVersion } =
Expand All @@ -22,7 +23,7 @@ export const useCreateNode = ({ workflow }: { workflow: Workflow }) => {
nodeToAdd: WorkflowStep;
}) => {
const lastVersion = getWorkflowLastVersion(workflow);
if (lastVersion === undefined) {
if (!isDefined(lastVersion)) {
throw new Error(
"Can't add a node when no version exists yet. Create a first workflow version before trying to add a node.",
);
Expand Down

0 comments on commit 0a46f9b

Please sign in to comment.