diff --git a/client/homebrew/editor/tagInput/tagInput.jsx b/client/homebrew/editor/tagInput/tagInput.jsx index 22760896a..f42e2f62f 100644 --- a/client/homebrew/editor/tagInput/tagInput.jsx +++ b/client/homebrew/editor/tagInput/tagInput.jsx @@ -1,5 +1,6 @@ const React = require('react'); const { useState, useEffect } = React; +const _ = require('lodash'); const TagInput = ({ unique = true, values = [], ...props }) => { const [temporaryValue, setTemporaryValue] = useState(''); @@ -25,6 +26,11 @@ const TagInput = ({ unique = true, values = [], ...props }) => { const submitTag = (newValue, originalValue) => { setValueContext((prevContext) => { + // add new tag + if(originalValue === null){ + return [...prevContext, { value: newValue, editing: false }] + } + // update existing tag return prevContext.map((context) => { if (context.value === originalValue) { return { ...context, value: newValue, editing: false }; @@ -45,9 +51,9 @@ const TagInput = ({ unique = true, values = [], ...props }) => { }); }; - const renderReadTag = (context) => { + const renderReadTag = (context, index) => { return ( -