diff --git a/frontend/src/pages/DataAnnotation/components/TemplateConfigurationTreeEditor.tsx b/frontend/src/pages/DataAnnotation/components/TemplateConfigurationTreeEditor.tsx index 19ce402..6b7f01f 100644 --- a/frontend/src/pages/DataAnnotation/components/TemplateConfigurationTreeEditor.tsx +++ b/frontend/src/pages/DataAnnotation/components/TemplateConfigurationTreeEditor.tsx @@ -247,18 +247,34 @@ const createNode = ( attrs[attr] = ""; }); - if (objectConfig && attrs.name !== undefined) { + if (objectConfig) { const name = getDefaultName(tag); - attrs.name = name; - if (attrs.value !== undefined) { - attrs.value = `$${name}`; + if (!attrs.name) { + attrs.name = name; + } + if (!attrs.value) { + attrs.value = `$${attrs.name}`; } } - if (controlConfig && attrs.name !== undefined) { - attrs.name = getDefaultName(tag); - if (attrs.toName !== undefined) { - attrs.toName = objectNames[0] || ""; + if (controlConfig) { + const isLabeling = controlConfig.category === "labeling"; + + if (isLabeling) { + if (!attrs.name) { + attrs.name = getDefaultName(tag); + } + if (!attrs.toName) { + attrs.toName = objectNames[0] || ""; + } + } else { + // For layout controls, only fill if required + if (attrs.name !== undefined && !attrs.name) { + attrs.name = getDefaultName(tag); + } + if (attrs.toName !== undefined && !attrs.toName) { + attrs.toName = objectNames[0] || ""; + } } }