SBIN2010 commented on code in PR #36083:
URL: https://github.com/apache/superset/pull/36083#discussion_r2561361633


##########
superset-frontend/package-lock.json:
##########
@@ -66264,6 +66264,17 @@
         "url": "https://github.com/chalk/chalk?sponsor=1";
       }
     },
+    "packages/superset-ui-demo/node_modules/core-js": {
+      "version": "3.39.0",
+      "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.39.0.tgz";,
+      "integrity": 
"sha512-raM0ew0/jJUqkJ0E6e8UDtl+y/7ktFivgWvqw8dNSQeNWoSDLvQ1H/RN3aPXB9tBd4/FhyR4RDPGhsNIMsAn7g==",
+      "hasInstallScript": true,
+      "license": "MIT",
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/core-js";
+      }
+    },

Review Comment:
   Is this really needed here?



##########
superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx:
##########
@@ -1202,6 +1210,41 @@ export default function TableChart<D extends DataRecord 
= DataRecord>(
 
   const [searchOptions, setSearchOptions] = useState<SearchOption[]>([]);
 
+  const handleFilteredDataChange = useCallback(
+    (rows: Row<D>[], searchText?: string) => {
+      if (!totals || serverPagination) {
+        return;
+      }
+
+      if (!searchText?.trim()) {
+        setDisplayedTotals(totals);
+        return;
+      }
+
+      const updatedTotals: Record<string, DataRecordValue> = { ...totals };
+
+      filteredColumnsMeta.forEach(column => {
+        if (column.isMetric || column.isPercentMetric) {
+          const aggregatedValue = rows.reduce<number>((acc, row) => {
+            const rawValue = row.original?.[column.key];
+            const numValue =
+              typeof rawValue === 'number'
+                ? rawValue
+                : typeof rawValue === 'string'
+                  ? Number(rawValue.replace(/,/g, ''))
+                  : NaN;

Review Comment:
   Can we simplify this design?



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