diff --git a/src/hooks/useLookup.tsx b/src/hooks/useLookup.tsx index 3d1709d..dba322c 100644 --- a/src/hooks/useLookup.tsx +++ b/src/hooks/useLookup.tsx @@ -135,7 +135,7 @@ const useLookup = (warningHandler?: WarningHandler) => { } async function submitInternal(): Promise { - if (target == null) + if (target == null || target.length == 0) throw new Error("A target must be given in order to execute a lookup."); const targetType = getType(target); @@ -173,9 +173,9 @@ const useLookup = (warningHandler?: WarningHandler) => { } } - async function submit( - props: SubmitProps - ): Promise { + async function submit({ + target, + }: SubmitProps): Promise { try { const response = await submitInternal(); if (response == undefined)