Skip to content

Commit

Permalink
make sure to set format id correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Sep 22, 2022
1 parent 6152de1 commit bb81400
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const formatColumnFn: FormatColumnExpressionFunction['fn'] = (
id: parentFormatId,
params: {
...col.meta.params?.params,
id: format,
id: supportedFormats[format].formatId,
...parentFormatParams,
// some wrapper formatters require params to be flatten out (i.e. terms) while others
// require them to be in the params property (i.e. ranges)
Expand All @@ -83,7 +83,7 @@ export const formatColumnFn: FormatColumnExpressionFunction['fn'] = (
id: parentFormatId,
params: {
...col.meta.params?.params,
id: format,
id: supportedFormats[format].formatId,
// some wrapper formatters require params to be flatten out (i.e. terms) while others
// require them to be in the params property (i.e. ranges)
// so for now duplicate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,14 @@ export const rangeOperation: OperationDefinition<
numberFormat &&
supportedFormats[numberFormat.id] &&
supportedFormats[numberFormat.id].decimalsToPattern(numberFormat.params?.decimals || 0);
const numberFormatId = numberFormat && supportedFormats[numberFormat.id].formatId;

const rangeFormatter = fieldFormats.deserialize({
...(currentColumn.params.parentFormat || { id: 'range' }),
params: {
...currentColumn.params.parentFormat?.params,
...(numberFormat
? { id: numberFormat.id, params: { pattern: numberFormatterPattern } }
? { id: numberFormatId, params: { pattern: numberFormatterPattern } }
: getFieldDefaultFormat(indexPattern, currentField)),
},
});
Expand Down

0 comments on commit bb81400

Please sign in to comment.