Skip to content

Commit ab5e2f7

Browse files
fixes bug where arrays are passed as [object Object]
1 parent 31ccf16 commit ab5e2f7

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/chart/ChartUtils.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,14 @@ export function replaceDashboardParameters(str, parameters) {
218218
let param = _.replace(`$`, '').trim();
219219
let val = parameters?.[param] || null;
220220
let type = getRecordType(val);
221-
let valueRender = type === 'string' || type == 'link' ? val : RenderSubValue(val);
222-
return valueRender;
221+
222+
// Arrays weren't playing nicely with RenderSubValue(). Each object would be passed separately and return [oject Object].
223+
if (type === 'string' || type == 'link' ) {
224+
return val;
225+
} else if (type === 'array') {
226+
return RenderSubValue(val.join(', '));
227+
}
228+
return RenderSubValue(val);
223229
};
224230

225231
let newString = str.replace(rx, parameterElementReplacer).replace(rxSimple, parameterSimpleReplacer);

src/chart/table/TableChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function renderAsButtonWrapper(renderer) {
5050
style={{ width: '100%', marginLeft: '5px', marginRight: '5px' }}
5151
variant='contained'
5252
color='primary'
53-
>{`${outputValue}`}</Button>
53+
>{outputValue}</Button>
5454
);
5555
};
5656
}

0 commit comments

Comments
 (0)