при создании узла ребенок не равен родителю

This commit is contained in:
Nastya 2023-12-13 13:53:59 +03:00
parent ff826e5e71
commit fb2aed7927
2 changed files with 10 additions and 3 deletions

@ -157,6 +157,12 @@ function CsComponent({
}, [modalQuestionTargetContentId])
const addNode = ({ parentNodeContentId, targetNodeContentId }: { parentNodeContentId: string, targetNodeContentId?: string }) => {
//запрещаем работу родителя-ребенка если это один и тот же вопрос
if (parentNodeContentId === targetNodeContentId) return
const cy = cyRef?.current
const parentNodeChildren = cy?.$('edge[source = "' + parentNodeContentId + '"]')?.length
//если есть инфо о выбранном вопросе из модалки - берём родителя из инфо модалки. Иначе из значения дропа

@ -85,11 +85,12 @@ export default function SettingEmoji({ question }: SettingEmojiProps) {
<CustomCheckbox
sx={{ mr: isMobile ? "0px" : "16px" }}
label={"Необязательный вопрос"}
checked={!question.required}
handleChange={(e) => updateQuestion(question.id, question => {
checked={question.content.required}
handleChange={({ target }) => updateQuestion(question.id, question => {
if (question.type !== "emoji") return;
question.content.required = !e.target.checked;
console.log(target.checked)
question.content.required = target.checked;
})}
/>
<Box