From 2ec59660de0dfd6431872a6a1b9790da37d73a28 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 9 Jan 2022 14:21:01 +0000 Subject: [PATCH] :bug: Fixes unable to edit item bug (#415) --- src/utils/SectionHelpers.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/SectionHelpers.js b/src/utils/SectionHelpers.js index 2d16ba18..28082bfb 100644 --- a/src/utils/SectionHelpers.js +++ b/src/utils/SectionHelpers.js @@ -8,7 +8,8 @@ export const shouldBeVisible = (routeName) => !hideFurnitureOn.includes(routeNam /* Based on section title, item name and index, return a string value for ID */ const makeItemId = (sectionStr, itemStr, index) => { const charSum = sectionStr.split('').map((a) => a.charCodeAt(0)).reduce((x, y) => x + y); - const itemTitleStr = itemStr.replace(/\s+/g, '-').replace(/[^a-zA-Z ]/g, '').toLowerCase(); + const newItemStr = itemStr || `unknown_${Math.random()}`; + const itemTitleStr = newItemStr.replace(/\s+/g, '-').replace(/[^a-zA-Z ]/g, '').toLowerCase(); return `${index}_${charSum}_${itemTitleStr}`; };