Skip to content

Commit 58ad7c6

Browse files
author
Stan van Rooy
authored
fix: handle invalid initial value in variable formatter (#36)
There seems to be an issue present in older versions of Grafana, where a wrong initial value is sent. This handles that edge case. https://github.com/parseablehq/parseable-datasource/assets/49564025/8ef3dd77-88ba-48ef-be37-f0210db64016
1 parent c815e81 commit 58ad7c6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/datasource.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,10 @@ export class DataSource extends DataSourceApi<MyQuery, MyDataSourceOptions> {
9191
}
9292

9393
private formatter(value: string | string[], options: any): string {
94-
if (options.multi) {
94+
if (options.multi && Array.isArray(value)) {
9595
return (value as string[]).map(v => `'${v}'`).join(',');
96+
} else if (options.multi) {
97+
return `'${value}'`;
9698
}
9799
return value as string;
98100
}

0 commit comments

Comments
 (0)