diff --git a/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx b/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx index b77a7499f..51b79dfcd 100644 --- a/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx +++ b/src/components/ModalsContainer/BlueprintModal/Body/Editor/index.tsx @@ -462,23 +462,27 @@ export const Editor = ({ return undefined }, [parent, selectedSchema, selectedNodeParentOptions]) + const selectedIndex = watch('selectedIndex') + const resolvedSelectedIndexValue = useMemo((): TAutocompleteOption | undefined => { - if (!selectedSchema) { - return undefined + if (selectedIndex) { + return { label: selectedIndex, value: selectedIndex } } - const option = attributes.find((attr) => attr.key === selectedSchema.index) + if (selectedSchema) { + const option = attributes.find((attr) => attr.key === selectedSchema.index) - if (option) { - return { label: option.key, value: option.key } - } + if (option) { + return { label: option.key, value: option.key } + } - if (selectedSchema.index) { - return { label: selectedSchema.index, value: selectedSchema.index } + if (selectedSchema.index) { + return { label: selectedSchema.index, value: selectedSchema.index } + } } return undefined - }, [selectedSchema, attributes]) + }, [selectedSchema, attributes, selectedIndex]) const IconComponent = Icons[selectedIcon as keyof typeof Icons]