bito-code-review[bot] commented on code in PR #44739:
URL: https://github.com/apache/superset/pull/44739#discussion_r4145485406
##########
superset-frontend/src/components/FilterableTable/index.tsx:
##########
@@ -98,7 +68,8 @@ export const FilterableTable = ({
label: key,
fieldName: key,
headerName: key,
- comparator: sortResults,
+ comparator: (a: CellDataType, b: CellDataType) =>
+ sortResults(a, b, data),
Review Comment:
<!-- Bito Reply -->
The suggestion is appropriate as it addresses the unstable comparator
identity by hoisting the comparator function outside the `useMemo` hook. This
change ensures a stable identity for the comparator, preventing unnecessary
re-evaluations of column definitions and sorts in AG Grid when the `data`
dependency changes.
**superset-frontend/src/components/FilterableTable/index.tsx**
```
const comparator = useCallback((a: CellDataType, b: CellDataType) =>
sortResults(a, b, data), [data]);
// ... later in the code
label: key,
fieldName: key,
headerName: key,
comparator: comparator,
```
--
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]