From d011c3c431d3ab8eee92bdd6576fffcf74dc8288 Mon Sep 17 00:00:00 2001 From: Mihail Gorceag <mgorceag@EN410053.local> Date: Mon, 5 Apr 2021 13:15:08 +0300 Subject: [PATCH] fix: fix ncrc manuscripts page crash --- .../component-manuscripts/src/Manuscript.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/components/component-manuscripts/src/Manuscript.js b/app/components/component-manuscripts/src/Manuscript.js index f088855a04..96d8028470 100644 --- a/app/components/component-manuscripts/src/Manuscript.js +++ b/app/components/component-manuscripts/src/Manuscript.js @@ -63,7 +63,7 @@ const User = ({ manuscriptId, manuscript, submitter, history, ...props }) => { }) } - const filterByTopic = (topic) => { + const filterByTopic = topic => { props.setSelectedTopic(topic) history.replace(`${urlFrag}/admin/manuscripts?topic=${topic}`) } @@ -80,10 +80,16 @@ const User = ({ manuscriptId, manuscript, submitter, history, ...props }) => { <Cell>{convertTimestampToDate(manuscript.updated)}</Cell> {process.env.INSTANCE_NAME === 'ncrc' && ( <Cell> - {manuscript.submission.topics.map((topic) => { - return <StyledTopic key={topic} title={convertCamelCaseToText(topic)} onClick={() => filterByTopic(topic)}> + {manuscript.submission?.topics?.map(topic => { + return ( + <StyledTopic + key={topic} + onClick={() => filterByTopic(topic)} + title={convertCamelCaseToText(topic)} + > {convertCamelCaseToText(topic)} </StyledTopic> + ) })} </Cell> )} -- GitLab