Skip to content

Commit

Permalink
🐛 Fixes unable to edit item bug (gchq#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Jan 9, 2022
1 parent 5a9017c commit 2ec5966
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/SectionHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
};

Expand Down

0 comments on commit 2ec5966

Please sign in to comment.