* copy defaultParams when changing an operation
* add type and name comparison
* removed name check
(cherry picked from commit 663f3fcd2a)
Co-authored-by: Sven Grossmann <Svennergr@gmail.com>
This commit is contained in:
co-authored by
Sven Grossmann
parent
8c2a855dee
commit
98b3d1e7b6
@@ -79,7 +79,16 @@ export const OperationHeader = React.memo<Props>(
|
||||
if (value.value) {
|
||||
// Operation should exist if it is selectable
|
||||
const newDef = queryModeller.getOperationDef(value.value.id)!;
|
||||
let changedOp = { ...operation, id: value.value.id };
|
||||
|
||||
// copy default params, and override with all current params
|
||||
const newParams = [...newDef.defaultParams];
|
||||
for (let i = 0; i < Math.min(operation.params.length, newParams.length); i++) {
|
||||
if (newDef.params[i].type === def.params[i].type) {
|
||||
newParams[i] = operation.params[i];
|
||||
}
|
||||
}
|
||||
|
||||
const changedOp = { ...operation, params: newParams, id: value.value.id };
|
||||
onChange(index, def.changeTypeHandler ? def.changeTypeHandler(changedOp, newDef) : changedOp);
|
||||
}
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user