From 55106ae6217c37751540722e1db9afb970c0e68b Mon Sep 17 00:00:00 2001 From: jonandernovella Date: Fri, 8 Sep 2023 17:37:20 +0200 Subject: [PATCH] fix: validate entry activities --- frontend/src/components/QuickAdd.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/QuickAdd.tsx b/frontend/src/components/QuickAdd.tsx index 38a6d158..adc16865 100644 --- a/frontend/src/components/QuickAdd.tsx +++ b/frontend/src/components/QuickAdd.tsx @@ -44,8 +44,8 @@ export const QuickAdd = ({ context ); if (!didCancel && result) { - setActivities(result.time_entry_activities); - setActivity(activity ? activity : result.time_entry_activities[0]); + setActivities(result.time_entry_activities ? result.time_entry_activities : []); + setActivity(activity ? activity : Array.isArray(result.time_entry_activities) ? result.time_entry_activities[0] : null); } }; @@ -80,7 +80,6 @@ export const QuickAdd = ({ candidateIssues = [foundIssue]; //allow for valid issue id autoselection if (isNumber(search.text)) { - console.log(foundIssue) setIssue(foundIssue); } } else { @@ -105,7 +104,6 @@ export const QuickAdd = ({ ); const suggestionSelected = (selection: Issue) => { - console.log(selection) setIssue(selection); // Update input box with selected issue let element = issueInputRef.current;