Skip to content

Commit

Permalink
Unique names for query parameters (re #164)
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Short authored and jezdez committed Jan 16, 2020
1 parent d2943b9 commit 1dc6c4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions client/app/services/parameters/Parameter.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ class Parameter {
const prefix = this.urlPrefix;
// `null` removes the parameter from the URL in case it exists
return {
[`${prefix}${this.name}`]: !this.isEmpty ? this.value : null,
[`${prefix}${this.name}_${this.parentQueryId}`]: !this.isEmpty ? this.value : null,
};
}

/** Set parameter value from the URL */
fromUrlParams(query) {
const prefix = this.urlPrefix;
const key = `${prefix}${this.name}`;
const key = `${prefix}${this.name}_${this.parentQueryId}`;
if (has(query, key)) {
this.setValue(query[key]);
}
Expand Down
2 changes: 1 addition & 1 deletion client/app/services/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ function QueryResource($resource, $http, $location, $q, currentUser, QueryResult
});
}
Object.keys(params).forEach(key => params[key] == null && delete params[key]);
params = map(params, (value, name) => `${encodeURIComponent(name)}=${encodeURIComponent(value)}`).join("&");
params = map(params, (value, name) => `${encodeURIComponent(name)}_${this.id}=${encodeURIComponent(value)}`).join("&");

if (params !== "") {
url += `?${params}`;
Expand Down

0 comments on commit 1dc6c4a

Please sign in to comment.