Skip to content

Commit

Permalink
fix(parent): we should be able to change parent of a particular node …
Browse files Browse the repository at this point in the history
…from graph
  • Loading branch information
MahtabBukhari committed Sep 18, 2024
1 parent 3679f4d commit a5871fe
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Flex>
Expand Down

0 comments on commit a5871fe

Please sign in to comment.