Fix: Fixed an issue where adding session variables multiple times would overwrite them. (#11308)
### What problem does this PR solve? Fix: Fixed an issue where adding session variables multiple times would overwrite them. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
3fcf2ee54c
commit
1dba6b5bf9
1 changed files with 22 additions and 19 deletions
|
|
@ -15,27 +15,30 @@ export const useHandleForm = () => {
|
|||
return value;
|
||||
}
|
||||
};
|
||||
const handleSubmit = useCallback(async (fieldValue: FieldValues) => {
|
||||
const param = {
|
||||
...(data.dsl?.variables || {}),
|
||||
[fieldValue.name]: {
|
||||
...fieldValue,
|
||||
value:
|
||||
fieldValue.type === TypesWithArray.Object ||
|
||||
fieldValue.type === TypesWithArray.ArrayObject
|
||||
? handleObjectData(fieldValue.value)
|
||||
: fieldValue.value,
|
||||
},
|
||||
} as Record<string, GlobalVariableType>;
|
||||
const handleSubmit = useCallback(
|
||||
async (fieldValue: FieldValues) => {
|
||||
const param = {
|
||||
...(data.dsl?.variables || {}),
|
||||
[fieldValue.name]: {
|
||||
...fieldValue,
|
||||
value:
|
||||
fieldValue.type === TypesWithArray.Object ||
|
||||
fieldValue.type === TypesWithArray.ArrayObject
|
||||
? handleObjectData(fieldValue.value)
|
||||
: fieldValue.value,
|
||||
},
|
||||
} as Record<string, GlobalVariableType>;
|
||||
|
||||
const res = await saveGraph(undefined, {
|
||||
globalVariables: param,
|
||||
});
|
||||
const res = await saveGraph(undefined, {
|
||||
globalVariables: param,
|
||||
});
|
||||
|
||||
if (res.code === 0) {
|
||||
refetch();
|
||||
}
|
||||
}, []);
|
||||
if (res.code === 0) {
|
||||
refetch();
|
||||
}
|
||||
},
|
||||
[data.dsl?.variables, refetch, saveGraph],
|
||||
);
|
||||
|
||||
return { handleSubmit, loading };
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue