bito-code-review[bot] commented on code in PR #44739:
URL: https://github.com/apache/superset/pull/44739#discussion_r4145218263
##########
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:
<div>
<div id="suggestion">
<div id="issue"><b>Unstable comparator identity</b></div>
<div id="fix">
The inline wrapper allocates a fresh `comparator` closure per column on
every `data` change (deps line 81), so AG Grid sees new comparator identities
each cycle and re-evaluates column defs/sorts; adding `data` to the useMemo
deps also needlessly recreates the `render` closures, which never read `data`.
Hoist a single `useCallback((a, b) => sortResults(a, b, data), [data])` above
the `useMemo` and reference it in the map.
</div>
</div>
<small><i>Code Review Run #ce5235</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]