codeant-ai-for-open-source[bot] commented on code in PR #38094:
URL: https://github.com/apache/superset/pull/38094#discussion_r4181115041


##########
superset-frontend/src/visualizations/TimeTable/utils/sparklineHelpers/sparklineHelpers.ts:
##########
@@ -97,6 +97,6 @@ export function createYScaleConfig(
  */
 export function transformChartData(
   data: Array<number | null>,
-): Array<{ x: number; y: number }> {
-  return data.map((num, idx) => ({ x: idx, y: num ?? 0 }));
+): Array<{ x: number; y: number | null }> {
+  return data.map((num, idx) => ({ x: idx, y: num }));

Review Comment:
   **Suggestion:** Null y values reach the linear scale, which coerces them to 
zero, so missing observations appear as false zero dips instead of gaps.
   
   **Assessment:** 🟠 `Major` Β· πŸ” `Occurrence: Sometimes` Β· 🏷️ `Logic error`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=f5071d3a53ea4b008c57c47db817a10d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=f5071d3a53ea4b008c57c47db817a10d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/src/visualizations/TimeTable/utils/sparklineHelpers/sparklineHelpers.ts
   **Line:** 101:101
   **Comment:**
        *Logic Error: Null y values reach the linear scale, which coerces them 
to zero, so missing observations appear as false zero dips instead of gaps.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38094&comment_hash=03f9951a4dc61316471149f0ec6d85c54c79c9084aac6457cad26e37a63d5a5f&reaction=like'>πŸ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38094&comment_hash=03f9951a4dc61316471149f0ec6d85c54c79c9084aac6457cad26e37a63d5a5f&reaction=dislike'>πŸ‘Ž</a>



##########
superset-frontend/src/visualizations/TimeTable/TimeTable.tsx:
##########
@@ -110,43 +110,39 @@ const TimeTable = ({
 
     return rows.map(row => {
       const valueField = row.label || row.metric_name || '';
-      const cellValues = columnConfigs.reduce<Record<string, ReactNode>>(
-        (acc, columnConfig) => {
-          if (columnConfig.colType === 'spark') {
-            return {
-              ...acc,
-              [columnConfig.key]: (
-                <Sparkline
-                  valueField={valueField}
-                  column={columnConfig}
-                  entries={entries}
-                />
-              ),
-            };
-          }
-
-          const { value, errorMsg } = calculateCellValue(
-            valueField,
-            columnConfig,
-            reversedEntries,
+      const cells: Record<string, ReactNode> = {};
+      // Precomputed per-column values, read by sortNumberWithMixedTypes via
+      // row.original.cellValues so sorting never has to recompute them.
+      const cellValues: Record<string, number | null> = {};
+
+      columnConfigs.forEach(columnConfig => {
+        const { value, errorMsg } = calculateCellValue(
+          valueField,
+          columnConfig,
+          reversedEntries,
+        );
+        cellValues[columnConfig.key] = value;

Review Comment:
   **Suggestion:** Legacy grouped rows use `column_name` instead of `label` or 
`metric_name`, so `valueField` becomes empty and this stores `undefined` for 
every metric; clicking those headers cannot sort.
   
   **Assessment:** 🟠 `Major` Β· πŸ” `Occurrence: Rarely` Β· 🏷️ `Incomplete 
implementation`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=92e5aab13a174b588f2c14c8af13cefe&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=92e5aab13a174b588f2c14c8af13cefe&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/visualizations/TimeTable/TimeTable.tsx
   **Line:** 124:124
   **Comment:**
        *Incomplete Implementation: Legacy grouped rows use `column_name` 
instead of `label` or `metric_name`, so `valueField` becomes empty and this 
stores `undefined` for every metric; clicking those headers cannot sort.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38094&comment_hash=1258007d49ca0e7aced414709dcca97cd542d076727d73f0aa8d738daca51f7b&reaction=like'>πŸ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38094&comment_hash=1258007d49ca0e7aced414709dcca97cd542d076727d73f0aa8d738daca51f7b&reaction=dislike'>πŸ‘Ž</a>



-- 
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