Skip to content

Commit 17d38c1

Browse files
update varibles usage in query comp
1 parent d3e06ba commit 17d38c1

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

client/packages/lowcoder/src/comps/queries/queryComp.tsx

+9-17
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import {
3737
FetchCheckNode,
3838
FetchInfo,
3939
fromRecord,
40-
fromValue,
4140
isCustomAction,
4241
MultiBaseComp,
4342
multiChangeAction,
@@ -369,7 +368,7 @@ QueryCompTmp = class extends QueryCompTmp {
369368
}
370369
if (action.type === CompActionTypes.EXECUTE_QUERY) {
371370
if (getReduceContext().disableUpdateState) return this;
372-
if(!action.args) action.args = this.children.variables.toJsonValue().filter(kv => kv.key).reduce((acc, curr) => Object.assign(acc, {[curr.key as string]:curr.value}), {});
371+
action.args = action.args || {};
373372
action.args.$queryName = this.children.name.getView();
374373

375374
return this.executeQuery(action);
@@ -711,25 +710,18 @@ class QueryListComp extends QueryListTmpComp implements BottomResListComp {
711710
}
712711

713712
nameAndExposingInfo(): NameAndExposingInfo {
714-
const result: NameAndExposingInfo = {};
713+
let result: NameAndExposingInfo = {};
715714
Object.values(this.children).forEach((comp) => {
716715
result[comp.children.name.getView()] = comp.exposingInfo();
717716

718-
const variables = comp.children.variables.toJsonValue();
719-
variables.forEach((variable: Record<string, any>) => {
720-
result[variable.key] = {
721-
property: fromRecord({
722-
value: fromValue(variable.value),
723-
}),
724-
propertyValue: {
725-
value: variable.value,
726-
},
727-
propertyDesc: {},
728-
methods: {},
729-
};
730-
})
717+
const variables = comp.children.variables.nameAndExposingInfo();
718+
if (variables) {
719+
result = {
720+
...result,
721+
...variables,
722+
}
723+
}
731724
});
732-
733725
return result;
734726
}
735727

0 commit comments

Comments
 (0)