Adarshvk98 commented on code in PR #3031:
URL:
https://github.com/apache/incubator-kie-tools/pull/3031#discussion_r2036465510
##########
packages/dmn-editor/src/dataTypes/DataTypes.tsx:
##########
@@ -169,13 +182,37 @@ export function DataTypes() {
addTopLevelItemDefinition(itemDefinition);
}
});
- }, [addTopLevelItemDefinition, settings.isReadOnly]);
+ }, [addTopLevelItemDefinition, isReadOnly]);
const [isAddDataTypeDropdownOpen, setAddDataTypeDropdownOpen] =
useState(false);
// Using this object because DropdownToggleAction's props doesn't accept a
'title'.
const extraPropsForDropdownToggleAction = { title: "New Data Type" };
+ const addDataTypesDropdownItems = useMemo(() => {
+ const dropdownItems = [
+ <DropdownItem
+ key={"paste"}
+ onClick={() => pasteTopLevelItemDefinition()}
+ style={{ minWidth: "240px" }}
+ icon={<PasteIcon />}
+ >
+ Paste
+ </DropdownItem>,
+ ];
+ if (isImportDataTypesFromJavaClassesSupported &&
javaCodeCompletionService) {
+ dropdownItems.unshift(
+ <ImportJavaClassesI18nDictionariesProvider key={"import-java-classes"}>
+ <ImportJavaClassesDropdownItem
+ javaCodeCompletionService={javaCodeCompletionService}
+ onClick={handleImportJavaClassButtonClick}
+ />
+ </ImportJavaClassesI18nDictionariesProvider>
+ );
+ }
+ return dropdownItems;
+ }, [isImportDataTypesFromJavaClassesSupported, javaCodeCompletionService]);
Review Comment:
I was wondering if it was really necessary to pass the remaining
`handleImportJavaClassButtonClick` and `pasteTopLevelItemDefinition` as
dependencies? because I think the only thing that would change would be the
`isImportDataTypesFromJavaClassesSupported` boolean flag and the
`javaCodeCompletionService`. I’m not sure if we should add them or not. WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]