michael-s-molina commented on code in PR #29900:
URL: https://github.com/apache/superset/pull/29900#discussion_r1931981357


##########
superset-frontend/src/components/FilterableTable/index.tsx:
##########
@@ -188,86 +109,52 @@ const FilterableTable = ({
     return values.some(v => v.includes(lowerCaseText));
   };
 
-  // Parse any numbers from strings so they'll sort correctly
-  const parseNumberFromString = (value: string | number | null) => {
-    if (typeof value === 'string') {
-      if (ONLY_NUMBER_REGEX.test(value)) {
-        return parseFloat(value);
-      }
-    }
-
-    return value;
-  };
-
-  const sortResults = (key: string, a: Datum, b: Datum) => {
-    const aValue = parseNumberFromString(a[key]);
-    const bValue = parseNumberFromString(b[key]);
-
-    // equal items sort equally
-    if (aValue === bValue) {
-      return 0;
-    }
-
-    // nulls sort after anything else
-    if (aValue === null) {
-      return 1;
-    }
-    if (bValue === null) {
-      return -1;
-    }
-
-    return aValue < bValue ? -1 : 1;
-  };
-
-  const keyword = useDebounceValue(filterText);
-
-  const filteredList = useMemo(
+  const columns = useMemo(
     () =>
-      keyword ? list.filter((row: Datum) => hasMatch(keyword, row)) : list,
-    [list, keyword],
+      orderedColumnKeys.map(key => ({
+        key,
+        label: key,
+        fieldName: key,
+        headerName: key,
+        comparator: sortResults,
+        render: ({ value, colDef }: { value: CellDataType; colDef: ColDef }) =>
+          renderResultCell({
+            cellData: value,
+            columnKey: colDef.field,
+            allowHTML,
+            getCellContent,
+          }),
+      })),
+    [orderedColumnKeys, allowHTML, getCellContent],
   );
 
-  // exclude the height of the horizontal scroll bar from the height of the 
table
-  // and the height of the table container if the content overflows
-  const totalTableHeight =
-    container.current && totalTableWidth.current > 
container.current.clientWidth
-      ? height - SCROLL_BAR_HEIGHT
-      : height;
+  const keyword = useRef<string | undefined>(filterText);
+  keyword.current = filterText;

Review Comment:
   @justinpark I'm not sure if you missed this comment?



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