Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed[BluePrint]: Unable to Change Index After Selecting From Dropdown in Edit Type Modal #2246

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
Loading