drop undefined arg value

This commit is contained in:
codetypes committed 2024-08-02 20:58:30 +08:00
1 parent 969eadd3ee
commit 27bf5b98cc
2 files changed
+7 -2

No files matched your search

+7
View File
@@ -206,11 +206,18 @@ export const checkNodeData = (data: NodeModel | null | undefined) => {
data.output.length = conf.output?.length || 0; data.output.length = conf.output?.length || 0;
} }
if (conf.args) { if (conf.args) {
const args: { [k: string]: unknown } = {};
for (let i = 0; i < conf.args.length; i++) { for (let i = 0; i < conf.args.length; i++) {
const key = conf.args[i].name;
const value = data.args?.[key];
if (value !== undefined) {
args[key] = value;
}
if (!checkNodeArg(data, conf, i, true)) { if (!checkNodeArg(data, conf, i, true)) {
hasError = true; hasError = true;
} }
} }
data.args = args;
} }
if (data.children) { if (data.children) {
-2
View File
@@ -405,7 +405,6 @@ export const zhNodeDef = () => {
name: "maxLoop", name: "maxLoop",
type: "int?", type: "int?",
desc: "最大循环次数", desc: "最大循环次数",
oneof: "最大循环次数",
}, },
], ],
doc: "+ 只能有一个子节点,多个仅执行第一个\n+ 只有当子节点返回 `failure` 时,才返回 `success`,其它情况返回 `running` 状态\n+ 如果设定了尝试次数,超过指定次数则返回 `failure`", doc: "+ 只能有一个子节点,多个仅执行第一个\n+ 只有当子节点返回 `failure` 时,才返回 `success`,其它情况返回 `running` 状态\n+ 如果设定了尝试次数,超过指定次数则返回 `failure`",
@@ -422,7 +421,6 @@ export const zhNodeDef = () => {
name: "maxLoop", name: "maxLoop",
type: "int?", type: "int?",
desc: "最大循环次数", desc: "最大循环次数",
oneof: "最大循环次数",
}, },
], ],
doc: "+ 只能有一个子节点,多个仅执行第一个\n+ 只有当子节点返回 `success` 时,才返回 `success`,其它情况返回 `running` 状态\n+ 如果设定了尝试次数,超过指定次数则返回 `failure`", doc: "+ 只能有一个子节点,多个仅执行第一个\n+ 只有当子节点返回 `success` 时,才返回 `success`,其它情况返回 `running` 状态\n+ 如果设定了尝试次数,超过指定次数则返回 `failure`",