-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix query based dropdown not adding quote marks correctly #4186
Changes from all commits
0bea95d
a248282
ac02337
3a0c461
27b27b8
18e2ed8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -253,6 +253,12 @@ export class Parameter { | |
} | ||
} | ||
|
||
if (this.type === 'query' && !isEmptyValue(value)) { | ||
if (this.multiValuesOptions && !isArray(value)) { | ||
value = [value]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. QueryBasedDropdown with multi-values should always hold array values in its structure. |
||
} | ||
} | ||
|
||
if (isDateRangeParameter(this.type)) { | ||
this.value = null; | ||
this.$$value = null; | ||
|
@@ -387,7 +393,8 @@ export class Parameter { | |
if (has(query, key)) { | ||
if (this.multiValuesOptions) { | ||
try { | ||
this.setValue(JSON.parse(query[key])); | ||
const valueFromJson = JSON.parse(query[key]); | ||
this.setValue(isArray(valueFromJson) ? valueFromJson : query[key]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turns out numbers are also parsed and converted 😅, so this makes sure we don't convert it unless it's an array. |
||
} catch (e) { | ||
this.setValue(query[key]); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now using a value from state + this method to make sure no invalid values will go to the
Select
component.