Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6786b8e

Browse files
variable override issue fixed
1 parent 424f429 commit 6786b8e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

‎client/packages/lowcoder/src/comps/controls/actionSelector/executeQueryAction.tsx‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,12 @@ export class ExecuteQueryAction extends ExecuteQueryTmpAction {
112112
override getView() {
113113
const queryName = this.children.queryName.getView();
114114
// const queryParams = keyValueListToSearchStr(Array.isArray(this?.children?.query) ? (this.children.query as unknown as any[]).map((i: any) => i.getView() as KeyValue) : []);
115-
const result = Object.values(this.children.queryVariables.children as Record<string, {
116-
children: {
117-
key: { unevaledValue: string },
118-
value: { unevaledValue: string }
119-
}}>)
120-
.filter(item => item.children.key.unevaledValue !== "" && item.children.value.unevaledValue !== "")
121-
.map(item => ({[item.children.key.unevaledValue]: item.children.value.unevaledValue}))
115+
const result = this.children.queryVariables.toJsonValue()
116+
.filter(item => item.key !== "" && item.value !== "")
117+
.map(item => ({[item.key as string]: item.value}))
122118
.reduce((acc, curr) => Object.assign(acc, curr), {});
119+
120+
result.$queryName = queryName;
123121
if (!queryName) {
124122
return () => Promise.resolve();
125123
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ QueryCompTmp = class extends QueryCompTmp {
364364
if (action.type === CompActionTypes.EXECUTE_QUERY) {
365365
if (getReduceContext().disableUpdateState) return this;
366366
if(!action.args) action.args = this.children.variables.children.variables.toJsonValue().reduce((acc, curr) => Object.assign(acc, {[curr.key as string]:curr.value}), {});
367+
action.args.$queryName = this.children.name.getView();
367368

368369
return this.executeQuery(action);
369370
}

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

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

33-
const mappedVariables = Object.keys(props.variables).map(key => ({key: `query1.variable.${key}`, value: props.variables[key]}));
34+
const mappedVariables = Object.keys(props.variables).map(key => ({key: `${props.args?.$queryName}.variables.${key}`, value: props.variables[key]}));
3435
let request: QueryExecuteRequest = {
3536
path: props.applicationPath,
3637
params: [

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /