Skip to content

Commit 8c176cb

Browse files
Allen Shortjezdez
authored andcommitted
Unique names for query parameters (re getredash#164)
1 parent dad916e commit 8c176cb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

client/app/services/query.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class Parameter {
144144
};
145145
}
146146
return {
147-
[`p_${this.name}`]: this.value,
147+
[`p_${this.name}_${this.queryId}`]: this.value,
148148
};
149149
}
150150

@@ -156,7 +156,7 @@ class Parameter {
156156
this.setValue([query[keyStart], query[keyEnd]]);
157157
}
158158
} else {
159-
const key = `p_${this.name}`;
159+
const key = `p_${this.name}_${this.query.id}`;
160160
if (has(query, key)) {
161161
this.setValue(query[key]);
162162
}
@@ -219,7 +219,9 @@ class Parameters {
219219
});
220220

221221
const parameterExists = p => includes(parameterNames, p.name);
222-
this.query.options.parameters = this.query.options.parameters.filter(parameterExists).map(p => new Parameter(p));
222+
this.query.options.parameters = this.query.options.parameters
223+
.filter(parameterExists)
224+
.map(p => new Parameter(Object.assign({ queryId: this.query.id }, p)));
223225
}
224226

225227
initFromQueryString(query) {
@@ -484,7 +486,7 @@ function QueryResource(
484486
params += '&';
485487
}
486488

487-
params += `p_${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
489+
params += `p_${encodeURIComponent(name)}_${this.id}=${encodeURIComponent(value)}`;
488490
});
489491
}
490492

0 commit comments

Comments
 (0)