mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
fix(table-charts): Prevent time grain from altering Raw Records in Tables + Interactive Tables (#37561)
This commit is contained in:
@@ -356,8 +356,13 @@ export default function TableChart<D extends DataRecord = DataRecord>(
|
||||
);
|
||||
|
||||
const timestampFormatter = useCallback(
|
||||
value => getTimeFormatterForGranularity(timeGrain)(value),
|
||||
[timeGrain],
|
||||
(value: DataRecordValue) =>
|
||||
isRawRecords
|
||||
? String(value ?? '')
|
||||
: getTimeFormatterForGranularity(timeGrain)(
|
||||
value as number | Date | null | undefined,
|
||||
),
|
||||
[timeGrain, isRawRecords],
|
||||
);
|
||||
const [tableSize, setTableSize] = useState<TableSize>({
|
||||
width: 0,
|
||||
|
||||
@@ -212,6 +212,7 @@ const processColumns = memoizeOne(function processColumns(
|
||||
metrics: metrics_,
|
||||
percent_metrics: percentMetrics_,
|
||||
column_config: columnConfig = {},
|
||||
query_mode: queryMode,
|
||||
},
|
||||
rawDatasource,
|
||||
queriesData,
|
||||
@@ -274,7 +275,7 @@ const processColumns = memoizeOne(function processColumns(
|
||||
const timeFormat = customFormat || tableTimestampFormat;
|
||||
// When format is "Adaptive Formatting" (smart_date)
|
||||
if (timeFormat === SMART_DATE_ID) {
|
||||
if (granularity) {
|
||||
if (granularity && queryMode !== QueryMode.Raw) {
|
||||
// time column use formats based on granularity
|
||||
formatter = getTimeFormatterForGranularity(granularity);
|
||||
} else if (customFormat) {
|
||||
|
||||
Reference in New Issue
Block a user