fix: setProps and setStepParams should use merge strategy

This commit is contained in:
gchust 2025-06-29 11:09:44 +08:00
parent 2a22cf4afc
commit 4ec878af8c

View File

@ -329,7 +329,7 @@ export class FlowModel<Structure extends { parent?: any; subModels?: any } = Def
if (typeof props === 'string') {
this.props[props] = value;
} else {
this.props = { ...props };
this.props = { ...this.props, ...props };
}
}
@ -351,7 +351,10 @@ export class FlowModel<Structure extends { parent?: any; subModels?: any } = Def
if (!this.stepParams[flowKey]) {
this.stepParams[flowKey] = {};
}
this.stepParams[flowKey][stepKeyOrStepsParams] = params;
this.stepParams[flowKey][stepKeyOrStepsParams] = {
...this.stepParams[flowKey][stepKeyOrStepsParams],
...params,
};
} else if (typeof stepKeyOrStepsParams === 'object' && stepKeyOrStepsParams !== null) {
this.stepParams[flowKey] = { ...(this.stepParams[flowKey] || {}), ...stepKeyOrStepsParams };
}