Skip to content

Commit 155bab4

Browse files
authored
Merge pull request #1531 from lowcoder-org/fix/variables_issue_s3
Fix issues on empty variable key & value and removed placeholder variables
2 parents f934eda + 5c160a8 commit 155bab4

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ QueryCompTmp = class extends QueryCompTmp {
363363
}
364364
if (action.type === CompActionTypes.EXECUTE_QUERY) {
365365
if (getReduceContext().disableUpdateState) return this;
366-
if(!action.args) action.args = this.children.variables.children.variables.toJsonValue().reduce((acc, curr) => Object.assign(acc, {[curr.key as string]:curr.value}), {});
366+
if(!action.args) action.args = this.children.variables.children.variables.toJsonValue().filter(kv => kv.key).reduce((acc, curr) => Object.assign(acc, {[curr.key as string]:curr.value}), {});
367367
action.args.$queryName = this.children.name.getView();
368368

369369
return this.executeQuery(action);

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ export function toQueryView(params: FunctionProperty[]) {
2828
variables?: any;
2929
timeout: InstanceType<ParamsControlType>;
3030
}): Promise<QueryResult> => {
31-
console.log("toQueryView props", props, params);
3231
const { applicationId, isViewMode } = getGlobalSettings();
3332

34-
const mappedVariables = Object.keys(props.variables).map(key => ({key: `${props.args?.$queryName}.variables.${key}`, value: props.variables[key]}));
33+
const mappedVariables = Object.keys(props.variables).filter(k => k !== "$queryName").map(key => ({key: `${props.args?.$queryName}.variables.${key}`, value: props.variables[key] || ""}));
3534
let request: QueryExecuteRequest = {
3635
path: props.applicationPath,
3736
params: [

0 commit comments

Comments
 (0)