From 24e8c9ea409038a883c904d80c0a5545f27d8e1e Mon Sep 17 00:00:00 2001 From: vmonakhov Date: Sun, 15 Dec 2024 17:23:30 +0300 Subject: [PATCH] fixes and beauty --- src/components/JoinMarkupsModal/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/JoinMarkupsModal/index.js b/src/components/JoinMarkupsModal/index.js index a30d22ad..1fa05237 100644 --- a/src/components/JoinMarkupsModal/index.js +++ b/src/components/JoinMarkupsModal/index.js @@ -131,7 +131,13 @@ const JoinMarkupsModal = ({ perspectiveId, onCloseUpdate, onClose }) => { setMarkupDict(markupDict); setGroupDict(groupDict); setGroupTotal(total); - } + }; + + const {data, error, loading, refetch} = useQuery(getMarkupTreeQuery, { + variables: { perspectiveId }, + //fetchPolicy: "network-only", + onCompleted: data => setRelationDict(data.markups) + }); const onAddRelation = useCallback(() => { //console.log("onAddRelation!!!!!!!"); @@ -249,6 +255,9 @@ const JoinMarkupsModal = ({ perspectiveId, onCloseUpdate, onClose }) => { const firstField = Object.keys(markupDict)[0]; const secondField = Object.keys(markupDict)[1]; + const firstText = markupDict[firstField].map(m => m.id === firstTextRelation ? m.text : ""); + const secondText = markupDict[secondField].map(m => m.id === secondTextRelation ? m.text : ""); + return ( {getTranslation("Join markups")} @@ -267,7 +276,7 @@ const JoinMarkupsModal = ({ perspectiveId, onCloseUpdate, onClose }) => { - {firstField.split('_')[1]}: {firstTextRelation} + {firstField.split('_')[1]}: {firstText} @@ -293,7 +302,7 @@ const JoinMarkupsModal = ({ perspectiveId, onCloseUpdate, onClose }) => { - {secondField.split('_')[1]}: {secondTextRelation} + {secondField.split('_')[1]}: {secondText}