EnxDev commented on code in PR #37561:
URL: https://github.com/apache/superset/pull/37561#discussion_r2766156564


##########
superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx:
##########
@@ -353,8 +353,19 @@ export default function TableChart<D extends DataRecord = 
DataRecord>(
   );
 
   const timestampFormatter = useCallback(
-    value => getTimeFormatterForGranularity(timeGrain)(value),
-    [timeGrain],
+    (value: DataRecordValue) => {
+      if (value == null) {
+        return '';
+      }
+      // In Raw Records mode, don't apply time grain-based formatting
+      if (isRawRecords || !timeGrain) {
+        return String(value);
+      }

Review Comment:
   String(null) returns 'null', so it might be better to avoid producing the 
literal string 'null'. 
   We could handle this case explicitly.



##########
superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx:
##########
@@ -353,8 +353,19 @@ export default function TableChart<D extends DataRecord = 
DataRecord>(
   );
 
   const timestampFormatter = useCallback(
-    value => getTimeFormatterForGranularity(timeGrain)(value),
-    [timeGrain],
+    (value: DataRecordValue) => {
+      if (value == null) {
+        return '';
+      }
+      // In Raw Records mode, don't apply time grain-based formatting
+      if (isRawRecords || !timeGrain) {
+        return String(value);
+      }
+      return getTimeFormatterForGranularity(timeGrain)(
+        value as number | Date | null | undefined,
+      );
+    },
+    [timeGrain, isRawRecords],

Review Comment:
   ```suggestion
         value => getTimeFormatterForGranularity(isRawRecords ? undefined : 
timeGrain)(value),
         [timeGrain, isRawRecords],
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to