From 784ebf632dbfb7fb2703ef542f799d4d92d17279 Mon Sep 17 00:00:00 2001 From: Spencer Stolworthy Date: Fri, 30 Oct 2020 16:59:12 -0500 Subject: [PATCH] Tag hotfix (#357) * add date to config json to avoid caching * fixed syntax error on qs * hotfix for tags * added todo comment, removed console log --- .../engagement_editable_categories.tsx | 10 +++++----- .../engagement/engagement_json_serializer.ts | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/engagement_categories/engagement_editable_categories.tsx b/src/components/engagement_categories/engagement_editable_categories.tsx index 1d2c804c1..cdefa2b0b 100644 --- a/src/components/engagement_categories/engagement_editable_categories.tsx +++ b/src/components/engagement_categories/engagement_editable_categories.tsx @@ -17,6 +17,7 @@ export function EngagementEditableCategories({ onSave: (engagement: Engagement) => void; engagement: Engagement; }) { + const { saveEngagement } = useEngagements(); const [chips, setChips] = useState([]); const [editMode, setEditMode] = useState(false); const [hasFetched, setHasFetched] = useState(false); @@ -76,10 +77,10 @@ export function EngagementEditableCategories({ const SaveAndCloseEditMode = (selectedChips: string[]) => { setEditMode(!editMode); - engagement.engagement_categories = selectedChips - .map(chip => [{ name: chip }]) - .flat(); - propsOnSave(engagement); + saveEngagement({ + ...engagement, + engagement_categories: selectedChips.map(chip => ({ name: chip })), + }); }; const cancelEdit = () => { @@ -103,4 +104,3 @@ export function EngagementEditableCategories({ ); } - diff --git a/src/serializers/engagement/engagement_json_serializer.ts b/src/serializers/engagement/engagement_json_serializer.ts index c92a1e1ea..2a60dd758 100644 --- a/src/serializers/engagement/engagement_json_serializer.ts +++ b/src/serializers/engagement/engagement_json_serializer.ts @@ -75,6 +75,9 @@ export class EngagementJsonSerializer deserialize(data: object): Engagement { return { ...data, + use_cases: data['use_cases'], + mongo_id: data['mongo_id'], + public_reference: data['public_reference'], additional_details: data['additional_details'], archive_date: data['archive_date'] ? EngagementJsonSerializer.parseDate(data['archive_date'])