This is an automated email from the ASF dual-hosted git repository.
yamer pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git
The following commit(s) were added to refs/heads/main by this push:
new 2738a26e696 kie-issues#1143: DMN Editor throws an error when deleting
Unknown nodes (#2288)
2738a26e696 is described below
commit 2738a26e6966494c0e6373174edd81413f007156
Author: Jozef Marko <[email protected]>
AuthorDate: Mon May 6 13:32:59 2024 +0200
kie-issues#1143: DMN Editor throws an error when deleting Unknown nodes
(#2288)
---
packages/dmn-editor/src/mutations/deleteNode.ts | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/packages/dmn-editor/src/mutations/deleteNode.ts
b/packages/dmn-editor/src/mutations/deleteNode.ts
index a3f07d7819a..c7dc7d75889 100644
--- a/packages/dmn-editor/src/mutations/deleteNode.ts
+++ b/packages/dmn-editor/src/mutations/deleteNode.ts
@@ -131,7 +131,12 @@ export function deleteNode({
throw new Error(`DMN MUTATION: Unknown node nature '${nodeNature}'.`);
}
- if (!dmnObject) {
+ if (!dmnObject && nodeNature !== NodeNature.UNKNOWN) {
+ /**
+ * We do not want to throw error in case of `nodeNature` equals to
`NodeNature.UNKNOWN`.
+ * In such scenario it is expected `dmnObject` is undefined as we can
not pair `dmnObject` with the `DMNShape`.
+ * However we are still able to delete at least the selected `DMNShape`
from the diagram.
+ */
throw new Error(`DMN MUTATION: Can't delete DMN object that doesn't
exist: ID=${dmnObjectId}`);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]