diff --git a/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx b/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx index 6bd562105..0b9bc65e2 100644 --- a/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx +++ b/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx @@ -388,22 +388,28 @@ export const Editor = ({ const resolvedParentValue = () => parentOptions?.find((i) => i.value === parent) const resolvedSelectedParentValue = useMemo((): TAutocompleteOption | undefined => { - if (!selectedSchema) { - return undefined - } + if (parent) { + const option = selectedNodeParentOptions?.find((i) => i.value === parent) - const option = selectedNodeParentOptions?.find((i) => i.value === selectedSchema.parent) + if (option) { + return option + } - if (option) { - return option + return { label: parent, value: parent } } - if (selectedSchema.parent) { + if (selectedSchema?.parent) { + const option = selectedNodeParentOptions?.find((i) => i.value === selectedSchema.parent) + + if (option) { + return option + } + return { label: selectedSchema.parent, value: selectedSchema.parent } } return undefined - }, [selectedSchema, selectedNodeParentOptions]) + }, [parent, selectedSchema, selectedNodeParentOptions]) return (